I’m trying to insert custom taxonomies using wp_insert_post()
and the tax_input
argument, but it doesn’t work. I want to set a post to a custom taxonomy (‘types’) and a category (‘cars’)
$new_post = array(
'post_title' => $title,
'post_content' => $description,
'tax_input' => array('types' => array('cars')),
'post_status' => 'pending',
'post_type' => 'vehicles'
);
I find the answer. After building my arguments for wp_insert_post() function and passed it to a variable $pid i set the following line after that and everything works slightly.