Is it possible to use the "wp_insert_post" function with custom taxonomies?
If I have created a cusom taxonomy called: people, and for a post I want to enter the name: "blair" how do I do this using wp_insert_post?
Is it possible to use the "wp_insert_post" function with custom taxonomies?
If I have created a cusom taxonomy called: people, and for a post I want to enter the name: "blair" how do I do this using wp_insert_post?
Might look at this pugin http://yoast.com/wordpress/simple-taxonomies/
I am using that plugin but need a way to use these custom taxonomies when using the wp_insert_post function
You might look this function wp_set_post_terms( $post_ID, $tags, $taxonomy, $append ) in the codex http://codex.wordpress.org/Function_Reference/wp_set_post_terms.
I use it in a form of my classifield site ;)
I am also trying to do this and it just doesn't got through!
$post_id = wp_insert_post( array(
'post_author' => $user_id,
'post_title' => $post_title,
'post_content' => $post_content,
'tags_input' => $tags,
'post_status' => 'publish'
) );
wp_set_post_terms( $post_id, $tax_mood ,'mood' ,false);Eh, it seemed like my problem was my text fields were not prefixed with "post." I don't know why this was a problem, but as soon as I changed them, the entire world opened up to me.
Hi, I'm having the same problem. Can you please elaborate on how you solved the problem?
Thanks
This topic has been closed to new replies.