diff --git a/includes/RestApi/SitePagesController.php b/includes/RestApi/SitePagesController.php index f99b6c075..5f171f167 100644 --- a/includes/RestApi/SitePagesController.php +++ b/includes/RestApi/SitePagesController.php @@ -94,7 +94,7 @@ private function set_homepage( $homepage_pattern_slug ) { \update_option( Options::get_option_name( 'show_on_front', false ), 'page' ); } - $post_id = $this->publish_page( 'Homepage', $pattern_data['content'] ); + $post_id = $this->publish_page( 'Homepage', $pattern_data['content'], true ); if ( is_wp_error( $post_id ) ) { return $post_id; } @@ -127,15 +127,19 @@ private function set_site_pages( $site_pages_pattern_slugs ) { return true; } - public function publish_page( $title, $content ) { + public function publish_page( $title, $content, $is_template_no_title = false ) { - return \wp_insert_post( - array( - 'post_title' => $title, - 'post_status' => 'publish', - 'post_content' => $content, - 'post_type' => 'page', - ) + $post = array( + 'post_title' => $title, + 'post_status' => 'publish', + 'post_content' => $content, + 'post_type' => 'page', ); + + if ( $is_template_no_title ) { + $post['page_template'] = 'no-title'; + } + + return \wp_insert_post( $post ); } }