WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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' );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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