how to associate custom taxonomy terms with post type insert into wp_term_relationships table.

1 Answer 1

$catids = $_POST['artticle_category'];
 * If the ids are coming from the database or another source, we would 
 * need to make sure these were integers or convert them to interger using intval:

$catids = array_map( 'intval', $catids );
$catids = array_unique( $catids );
$taxonomy = 'articles_category';
$post_id = '1';

$term_taxonomy_ids = wp_set_object_terms( $post_id, $catids , $taxonomy );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.