📌  相关文章
📜  wordpress 以编程方式添加新页面 - PHP 代码示例

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

代码示例1
$new_page = array(
    'comment_status' => 'close',
    'ping_status' => 'close',
    'post_author' => $user_ID,
    'post_title' => ucwords('title_of_the_page'),
    'post_name' => strtolower(str_replace(' ', '-', trim('title_of_the_page'))),
    'post_status' => 'publish',
    'post_content' => 'Content of the page',
    'post_type' => 'page',
    'post_parent' => 'id_of_the_parent_page_if_it_available'
);
$post_id = wp_insert_post($new_page);