您可以使用wp_insert_post() 函数\'after_theme_setup\' 动作挂钩,以编程方式创建页面。下面是一个简短的示例,
add_action( \'after_setup_theme\', \'create_form_page\' );
function create_form_page(){
$title = \'Form\';
$slug = \'form\';
$page_content = \'\'; // your page content here
$post_type = \'page\';
$page_args = array(
\'post_type\' => $post_type,
\'post_title\' => $title,
\'post_content\' => $page_content,
\'post_status\' => \'publish\',
\'post_author\' => 1,
\'post_slug\' => $slug
);
if(post_exists($title) === 0){
$page_id = wp_insert_post($page_args);
}
}