我正在创建一个带有 Wordpress 子主题的 APP。wp_insert_post
它有一个在激活主题时创建的起始页。如何在functions.phpstartpage
中设置此页面与 PHP一样?
// Install theme
if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) {
$last_id = wp_insert_post(array(
'post_type' => 'page',
'post_title' => 'Welcome to this wonderful page!',
'post_content' => 'Holy smoke',
'post_name' => 'startpage',
'post_status' => 'publish',
'comment_status' => 'closed'
));
update_post_meta($last_id, "_wp_page_template", "page.php");
// Set this page as startpage... but how?
} // Install theme