使用tax\\u输入参数如下:
$categories = array(51,52,53,54,55);
$post_id = wp_insert_post( array(
\'post_content\' => \'\',
\'post_name\' => $title_slug,
\'post_title\' => $title_slug,
\'post_status\' => \'publish\',
\'post_type\' => \'test\',
\'post_author\' => \'me\',
\'post_excerpt\' => \'\',
// \'post_date\' => $date,
\'post_category\' => $categories_id,
// \'tags_input\' => array($tags),
\'tax_input\' => array(
\'category\' => $categories
);
));
快乐编码;)