When you are running a WordPress multisite, each time you create a new site is WordPress automatically adds a sample page to the new site. The question is if it is possible to remove the default sample page and add desired owned default pages.
Adding / Removing Default Pages in WordPress
Simply add this code to your main site’s functions.php file or a site-specific plugin.

add_action('wpmu_new_blog', 'wpb_create_my_pages', 10, 2); 
function wpb_create_my_pages($blog_id, $user_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 the WP default 'Sample Page'
$defaultPage = get_page_by_title( 'Sample Page' );
wp_delete_post( $defaultPage->ID );	 

The first part of this code inserts a new WordPress page titled ‘About’ whenever a new site is created on your multisite network. The second part of the code finds and deletes default WordPress Sample Page.
We hope this article helped you add / remove default pages in WordPress multisite network.

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Also Read  Allow Users to Tweet your Post in Wordpress

CMSFolks Editorial Crew

Editorial Staff at CMSFolks is a team of WordPress experts led by Ajayi Adekunle. Site maintained by CMSFolks Studio.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu

Spelling error report

The following text will be sent to our editors: