As experienced WordPress Multisite administrators, we've helped countless users streamline their network setups. By default, every new site includes a bland sample page. This guide shows you how to remove it and add your own custom default pages effortlessly.
Replacing the default sample page offers key benefits. Create a welcoming 'Next Steps' page to guide new users, craft engaging content that's on-brand, or set clear network guidelines on dos and don'ts.
Add this proven code snippet to your main site's functions.php file or a site-specific plugin. It fires on new site creation via the wpmu_new_blog hook.
add_action( 'wpmu_new_blog', 'wpb_create_my_pages', 10, 2 );
function wpb_create_my_pages( $blog_id, $user_id ) {
switch_to_blog( $blog_id );
// Create new page
$page_id = wp_insert_post( array(
'post_title' => 'About',
'post_name' => 'about',
'post_content' => 'This is an about page. Feel free to edit or delete this page.',
'post_status' => 'publish',
'post_author' => $user_id, // or "1" (super-admin)
'post_type' => 'page',
'menu_order' => 1,
'comment_status' => 'closed',
'ping_status' => 'closed',
));
// Find and delete WP's default 'Sample Page'
$default_page = get_page_by_title( 'Sample Page' );
if ( $default_page ) {
wp_delete_post( $default_page->ID );
}
restore_current_blog();
}The code creates an 'About' page with custom content on every new site and removes the default 'Sample Page'. Test in a staging environment first.
This approach has reliably enhanced Multisite workflows for our clients. Questions? Drop a comment below.