Custom field when adding new site to multisite networked WordPress

Sorry, bad news.

If you look in the code-base of WP 3.9 for the responsible PHP file (which is site-new.php) you’ll unfortunately see that this is all hardcoded, like a lot of stuff in wp-admin, which IMHO totally sucks. 🙁

The only thing you can do is to build your own page for site creation and make it replace the default wordpress one.


To give you a start on this:

The easiest way to do this is to use add_menu_page() to define your own custom admin menu page.

add_menu_page( 'Add site', 'Add site', 'manage_options', 'cusom-new-site-page', function() {
        // your custom code for this page ...
});

The function to create a new site is wpmu_create_blog(), but you can also look into the existing file for that logic.

After this you could use add_rewrite_rule() to add a rewrite from the existing page to your custom one. Your rewrite rule could look like this one:

RewriteRule ^(.*)/wp-admin/network/site-new.php $1/wp-admin/admin.php?page=cusom-new-site-page [L]

Leave a Comment