ID) ) { $page_id = (int) $existing->ID; update_option('bongoto_welcome_page_id', $page_id); } else { $page_id = wp_insert_post(array( 'post_title' => $title, 'post_name' => $slug, 'post_status' => 'publish', 'post_type' => 'page', 'post_content' => '', // UI will come from the assigned template )); if ( is_wp_error($page_id) || ! $page_id ) { return; } update_option('bongoto_welcome_page_id', (int) $page_id); } // Assign the template you created: // File: page-templates/template-welcome-home.php update_post_meta( $page_id, '_wp_page_template', 'page-templates/template-welcome-home.php' ); // Set as the Front Page (the page name is not "Home", but it will show as the homepage) update_option('show_on_front', 'page'); update_option('page_on_front', (int) $page_id); }, 20);