amritansh of Tact9-GIST
4/1/2016 - 1:10 PM

This function attach terms to a post

This function attach terms to a post

attach_the_terms_to_a_post($post_id, $taxanomy_name, $combine_term_ids);

function attach_the_terms_to_a_post($post_id, $taxanomy_name, $combine_term_ids) {
    $combine_term_ids = array_map('intval', $combine_term_ids);
    $result = wp_set_object_terms($post_id, $combine_term_ids, $taxanomy_name);

    return $result;
}