How to add post category (taxonomy) in wp_insert_post
-
Hi,
I can’t add a category when i create a new post (in development).
I use template with custom post named “artist” and use taxonomy “artist category” and i use this code for add a new post :
$newPost = array( 'post_title' => $user->nickname, 'post_content' => $user->description, 'post_status' => 'pending', 'post_author' => $userID, 'post_type' => 'cpt_artists', 'tax_input' => array( 'category' => array( 'dj' ) ));
But it’s not working … ??
Do you have an idea ? Thanks
[ Please do not bump, that’s not permitted here. ]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to add post category (taxonomy) in wp_insert_post’ is closed to new replies.