I have a multiste installation that setups a site on user registration, logs them into their new site and then redirects them to their new site's homepage. This works perfectly however I have a strange homepage setup issue:

When I try and set the homepage using the following:

/** Homepage Setup **/
if (!current_user_can( 'manage_options' )) {
$homepage = get_page_by_title( 'home' );

if ( $homepage )
    update_option( 'page_on_front', $homepage->ID );
    update_option( 'show_on_front', 'page' );

in the multisite site's functions file the user is not initially taken through to this page, instead they are initially shown the default hello world post on first site load instead of the templated homepage as setup above. Strangely if the user reloads the page the homepage is then set correctly. It looks as if the function is not loading when the user is initially redirected to the site, i.e. it is running the setup after the first page has been loaded however this doesn't seem to make sense to me as other sections of that functions file run. Does anyone have any idea of what might be going wrong here?

1 Answer 1


I would say that the parsing of the "hello world" post is due to the site home url being the default for new site initially. So after the theme functions.php file has run the first time on the first time the site is called your settings are updated by your code, then any future landing on the subsite home will be the home page as you want.

Have a go at tying your code to the new site creation hook.wpmu_new_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.