I'd like to run some custom validation code on attempts to create new sites on my MultiSite environment, particularly the /wp-admin/network/site-new.php page. I've explored site-new.php, and have found zero instances of do_action() and the only filter is for subdirectory_reserved_names.

I imagine I could write some overly general code that runs on something like every admin_init, check to see if this is the site-new page, see if the $_POST['action'] is set and equals 'site-new', verify the nonce, etc... but that really doesn't seem like it could be the best / proper way.

Any suggestions on how to add my own custom validation code before a new site is actually created?

Note that the hook wpmu_validate_blog_signup is available for when users are using the public-facing signup form, so validation against THAT form is pretty straightforward. It appears, though, that there is no easy way to do similar validation for sites created from the Network dashboard.

1 Answer 1


Doing something before wpmu_create_blog() is called seems to be indeed hard. Not sure if I miss something …

You can hook into the action check_admin_referer and print your own error message:

if ( is_network_admin()
    && isset ( $_REQUEST[ 'action' ] )
    && 'add-site' === $_REQUEST[ 'action' ] )
    add_action( 'check_admin_referer', function( $action )
        if ( 'add-blog' !== $action )

        die( 'Nope.' );

        // inspect $_POST, do something.
        // Change $_POST['blog'] to get the best matching error message

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.