Usage
This function runs automatically, so it is not called manually. Is this incorrect?
Additional Notes
Uses the Sample Page if available, otherwise creates a new home page with an ID of 0.
This function will not override a home page if one exists already.
Source File
Located in /libs/Admin/Automation.php on line 376.
No Hooks
This function does not have any filters or actions available. Request one?
PHP
public function initialization_create_homepage(){
$this->cli_output('Creating a home page');
$current_front_page = get_option('page_on_front');
$sample_page = get_page_by_title('Sample Page');
if ( empty($current_front_page) || $current_front_page === $sample_page ){
$new_homepage_id = ( !empty($sample_page) )? $sample_page : 0;
wp_insert_post(array(
'ID' => $new_homepage_id,
'post_type' => 'page',
'post_title' => 'Home',
'post_name' => 'home',
'post_status' => 'publish',
'post_author' => get_current_user_id(),
));
update_option('page_on_front', get_page_by_title('Home'));
update_option('show_on_front', 'page');
}
}
Override
This function can not be short-circuited with an override filter. Request one?