I have this little code to insert posts via custom form:
$post = array(
'post_author' => 1,
'post_title' => 'my title,
'post_content' => 'my content',
'post_category' => array(3),
'post_type' => 'post',
);
if ( $post_id = wp_insert_post( $post ) ){
echo 'post added!';
}
but now I need to insert the last $post_id to term_relationships table,
basic scheme of term_relationships:
object_id | term_taxnomy_id | term_order
-----------------------------------------
Wordpress have a function to update that table?, or I need to build a custom query?