0
为IM V类试图插入类别插入标签通过PHP
$apples = "granny smith"
为一个新的职位的一部分。
我可以用下面的脚本很容易地创建一个新的职位与TAG:
$my_post = array(
'post_title' => $title,
'post_content' => $content,
'post_status' => 'publish',
'post_author' => 1,
'tags_input' => $apples,
'post_type' => 'post'
);
wp_insert_post($my_post);
但出于某种原因,尽管该WP抄本列出
'post_category'
的类别,下面的代码不创建新的类别“奶奶史密斯”,而是作为“未分类”进入新的职位:
$my_post = array(
'post_title' => $title,
'post_content' => $content,
'post_status' => 'publish',
'post_author' => 1,
'post_category' => $apples
'post_type' => 'post'
);
wp_insert_post($my_post);
有人可以帮助我的代码吗?我哪里错了?