所以我想用我的插件以编程方式添加帖子,我编写这段代码:
$my_post = array(
'post_title' => 'My post',
'post_content' => 'This is my post.',
'post_status' => 'draft',
'post_author' => get_current_user_id(),
'post_category' => array(1)
);
// Insert the post into the database
$post_id = wp_insert_post( $my_post );
,这是将帖子ID返回到变量,但帖子未显示在wp admin帖子表中。 WordPress正在像新帖子一样计数,但未显示。为什么?