3

I have a multisite setup in WordPress. Is there a way for me to implement a custom field when I create a new site in Admin > Sites > Add New. My current options are Site Address, Site Title, Admin Email. I'd like to add another field that I could fill in to be associated with these new sites.

2

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]
  • Ahh, I was hoping it was going to be a bit less complex. Thanks for looking into this though. – Mike Jul 1 '14 at 16:56

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.