Is there a way to either change the name of the default Sample Page or create a new page entirely everytime a user creates a new blog on WP multisite?

1 Answer 1


Core function

The core function wp_insert_post() can add & create posts (of every post type).


Plugin Name: Add default blog pages
Plugin URl: http://goo.gl/5e1DC
Author: Kaiser
Author URI: http://unserkaiser.com 
 * Default Blog pages - used to define all default pages.
 * Adjust this to your needs:
 * For a full example of what you can define for every page, take a look at
 * @link http://codex.wordpress.org/Function_Reference/wp_insert_post
 * @return array
function wpse50318_default_blog_pages()
    return array( 
            'post_title' => 'About'
            'post_title' => 'Contact'
 * Adds Default Blog pages
 * @return void
function wpse50318_add_default_pages_to_blog()

    foreach ( get_pages() as $page )
        $existing_pages[] = $page->post_title;

    // Get only non existing pages:
    $new_pages = array_diff( $GLOBALS['$wpse50318_default_blog_pages'], $existing_pages);

    // Loop over the non existing & add them
    foreach( $new_pages as $page )
        // Create post object
        $page['post_status']  = 'publish';
        $page['post_type']    = 'page';

        // Insert the post into the database
        wp_insert_post( $page );
add_action( 'activate_blog', 'wpse50318_add_default_pages_to_blog' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.