📜  wordpress 以编程方式添加新帖子 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:34.253000             🧑  作者: Mango

代码示例1
$new_post = array(
'post_title' => 'My New Post',
'post_content' => 'Lorem ipsum dolor sit amet...',
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'post',
'post_category' => array(0)
);
$post_id = wp_insert_post($new_post);