8. Bulk adding sites to WPMU DEV Hub
- Do you use a 3rd-party tool to manage plugins for dozens or even hundreds of sites?
- Do you want to ensure that all your sites are connected to your WPMU DEV Hub as well so you can benefit from all the Pro features of WPMU DEV plugins?
- Do you want to avoid having to log into the WPMU DEV Dashboard plugin in each site’s wp-admin individually to unlock Pro features?
If you answered yes to any of the above questions, we have a handy little process for you to make your life a bit easier. This process enables you to automatically log-in to the WPMU DEV Dashboard on any site, add it to your Hub, and ensure any free WPMU DEV plugin you may have installed is upgraded to the Pro version, all without needing to log into the site at all.
Before we begin though, it’s important to note that the WPMU DEV Dashboard plugin must be already installed and active on the site. The following process can automatically log you into the Dashboard plugin, add your sites to the Hub, and upgrade your free WPMU DEV plugins, but it cannot install or activate the Dashboard plugin for you.
8.1 Step 1 - Add a mu-pluginCopy chapter anchor to clipboard
The first thing you’ll need to do for each site you want to use this process for is upload an mu-plugin to it. If you use a 3rd-party tool to manage plugins on your sites, you can probably upload it to multiple sites in bulk using that tool. If not, then you’d use either FTP or your hosting control panel’s File Manager utility to upload it to each site you want it to run on.
If you need help with mu-plugins, see our Installing Mu-plugins doc.
This is the code you’d want to add in your mu-plugin:
Once you have the mu-plugin uploaded to each site you want to run this process on, proceed to step 2 below.
Once you’re finished with the following process, you’ll want to remove this mu-plugin from each site for security.
8.2 Step 2 - Make a cURL requestCopy chapter anchor to clipboard
Making a cURL request simply sends instructions to the site to remotely work the magic we want. If you’re familiar with making cURL requests, you can use any method you’re comfortable with.
If you’ve never done this before, we recommend using Postman as it’s the simplest solution we could think of for making a cURL request.
You can either download the free Postman app or use their browser version here: https://www.postman.com/downloads/ These instructions can be followed for either the Postman app or their browser version.
Once you have Postman up and running on your computer, click the Import button in the menu at top-left.
Then, in the little modal window that pops open, select the Raw Text option.
Paste the following code in the text field there:
Click the Continue button there, then click the Import button to confirm the import.
Now, in the right-hand pane in Postman, click on the Body option in the menu under the Post field to reveal your cURL request values.
Then change example.com in the Post field URL to the domain name of the 1st site you want to run this process on.
If you want to upgrade free WPMU DEV plugins to their Pro versions on that site, be sure to uncheck the box next to the skip_upgrade_free_plugins option.
Finally, click in the field where it says APIKEY to edit it. You want to copy your actual WPMU DEV API key from the API Key section on your Account page and paste it there.
Once you’re done with all that, click the Send button to execute the cURL request on the site whose domain name you entered in the Post field.
Voilà! You are now logged into the WPMU DEV Dashboard plugin on that site, the site has been added to your Hub, and any free WPMU DEV plugins installed there have been upgraded to their Pro versions (if you unchecked that option).
Once you have done all of the above for one site, repeating the process for multiple sites couldn’t be easier.
All you need to for the next site is change the domain name in the Post field to another site’s domain name, and click the Send button again to execute the cURL request for that site. Just repeat that one step for every site you want to run the request on.
So if you’re an agency operator with hundreds of sites, you can see how this process could save you tons of time. Have fun! :)
Oh, and please do remember to remove the mu-plugin from each site when you’re done.
8.3 Possible IssuesCopy chapter anchor to clipboard
If your cURL request was successful, you’ll see a confirmation message like this in the Response field at the bottom of the right-hand pane in Postman:
If the API key you entered is incorrect, you’ll see an error message like this in that field:
If you had forgotten to first upload the mu-plugin to the site, or it is not properly added, you’ll see an error message like this:
If you’re using the web version of Postman and your site’s CORS policy does not allow remote cURL requests, you’ll see an error like this and you’ll want to use their desktop app instead: