I'm a big fan of WordPress Multisite: I use it to manage a small network of client sites, hold all of my demo sites in one place, and also run a network allowing people to create their own custom sites.
So it's always nice to see Multisite getting a bit of love when WordPress is updated. WordPress version 4.4 included some nice enhancements to Multisite, which are particularly useful if you're customizing the signup process or working with options. Here's an overview of them.
The WP_Network Object
WP_Network has been added to make the way Multisite is set up tidier and better defined. It populates the
If you're manually populating those globals, or interacting with them in another way, you may need to test your code, although the core team have tested the changes to maximise backwards compatibility.
Functions for Network Options
WordPress 4.4 introduced four new functions relating to network options:
These are used for storing options from networks other than the current one. If you need to work with options relating to the current network, then use the existing functions:
It's important to be aware that the naming of these functions is confusing, because the
*_site_option() functions are the same functions you would use if your WordPress installation wasn't running Multisite. So if you're running a network, the
*_site_option() functions relate to the entire network, not just to one site, and the
*_network_option() functions don't relate to your current network, but to a network other than the current one.
New Action Hooks
Version 4.4 also introduced some new hooks which you might find useful if you're modifying the way your network is configured.
These are as follows:
before_signup_header: this new action is fired before the signup page is loaded, in
wp-signup.php. So if you want to make changes to the signup page, redirect to another page or make checks before loading the signup page, then you can attach your functions to this hook.
ms_network_not_found: this action hook fires just before the
ms_not_installedhook if the
$current_siteglobal hasn't been filled. Previously, the
ms_site_not_foundhook would fire, but this allows for more specific responses for multisite networks. This means that if a network isn't found, you can use this hook to define a fallback such as redirect to an alternative network, instead of simply displaying an error screen.
invite_userhook fires after a user is invited to join a network but before a notification is sent to them. Use this if you need to modify the way the notification works or make something else happen first (such as a notice or a notification to another user).
Enhancements to the Network Admin User Interface
There have also been some small but useful enhancements to the network admin user interface, including:
- For network admins (or other users with the
manage_networkcapability), network activated plugins can be viewed on the Plugins screen for each site in the network. I've already found this useful on one of the networks I manage as it helps me to identify any potential plugin conflicts on an individual site.
- When adding a new site to the network, you can now choose the language for the new site, which doesn't have to be the same as the base site or other sites in the network. This applies both when adding a site via the Network admin and via the
wp-signup.phppage. This will be useful for networks of sites managed by people speaking different languages. I've used Multisite to manage multilingual networks in the past when a client has needed a different site for each country they operate in, and this will be a really useful feature in cases such as that.
- When searching for users in your network, you can now use asterisks to find a looser match for your search terms. This is useful if you have a network with a large number of users and you want to find all users with the same suffix to their email address, for example.
The enhancements I've listed above include some small user experience improvements plus some functions and hooks that will be useful to developers working with custom Multisite installations. If you've customised the signup process, for example, you'll find hooks that will be useful to you.
Remember, if you're looking for other utilities to help you build out your growing set of tools for WordPress, see what we have available in Envato Market.
It's good to see Multisite getting some improvements with this release—long may it continue!