WordPress wp_insert_post not inserting tags
php, wordpress
Solution
Use the `wp_set_object_terms()` function:
http://codex.wordpress.org/Function_Reference/wp_set_object_terms
wp_set_object_terms($post_id , $arrayoftags, $name_of_tag_taxonomy, false);
Good luck
Problem
I am trying to insert a post with this code: ``` $my_post = array( 'post_type' => "essays", 'post_title' => 'TEST 3', //'post_content' => $content, 'post_status' => 'draft', 'post_author' => 1, //'post_category' => $cat, 'tags_input' => 'TQM,tag', ); $post_id = wp_insert_post($my_post); ``` Everythings works ok except the tags, it does not insert any of them. Any idea?