How to set a Static page (example Sample Page with every WordPress install) as default fron page for every newly created site on multisite network. I mean when a new user creates a site on my multisite network a Page with custom name sets as front page automatically. Please tell me how to accomplish that.


Try the following code. Based on these two Q&A's (not tested):

add_action( 'wpmu_new_blog', 'process_extra_field_on_blog_signup', 10, 6 );

function process_extra_field_on_blog_signup( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
    $homepage = get_page_by_title( 'Sample Page' );   
    if ( $homepage )
        update_blog_option( $blog_id, 'page_on_front', $homepage->ID );
        update_blog_option( $blog_id, 'show_on_front', 'page' );

Use it as a Must Use plugin.


Wordpress provides a function update_option to set static page programmatically by default when a new blog is created in network multisite.

function my_new_blog_settings($blog_id, $user_id) {

    // set static front page in general settings
    update_option( 'show_on_front', 'page', true);

    // set the static page based on page ID 
    update_option( 'page_on_front', $page_id, true);

Above given code can be invoked using action 'wpmu_new_blog'

add_action('wpmu_new_blog', 'my_new_blog_settings', 10, 2);

1) To set Your first page you can add new page as home.php in your directory. Wordpress by default take home.php as its first page if it is declared.

2) Go to settings->Reading->Front page display. You can set here your front page which will display when your site open.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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