WordPress Multisite User Management
If you have ever wondered how users are handled in a WordPress Multisite network, then this tutorial will definitely be helpful for you.
We will discuss various aspects of multisite user management: registrations, user roles in multisites, and associating users with specific sites of a network.
Shared Users in a WordPress Multisite Network
What is important to remember here is that users in any WordPress Multisite network are shared by default.
Not sure whether you’re familiar with the WordPress Multisite database structure, but here’s how it works:
| Shared database table | What is it for? |
|---|---|
wp_users | It stores user IDs, usernames, passwords, and emails. |
wp_usermeta | Stores user metadata; however, it is also used to store roles and capabilities related to certain sub-sites of the multisite network. |
In other words, it also means that users across the multisite network will have the same data, for example, the same password; however, some metadata, like roles, for example, will be unique for every site the user is added to. Though the user roles are stored in the wp_usermeta table, the meta key is used in a format wp_{BLOG ID}_capabilities, where the “blog ID” is a specific sub-site these role settings are for.
User Registration
There are actually two scenarios that we can define as a user registration:
- A user is created within a multisite network (it can be added to a specific website at the same time or not),
- A user was already created in the multisite network, and is now added (registered) for a specific sub-site in a multisite network.
Also, there are a bunch of registration settings we need to keep in mind, available in the network settings:

Creating a user in the network admin dashboard manually
If you’re a super administrator, you can easily create a user from the network dashboard just by providing a username and email.

Users can register themselves using a form
In practice, it works that way: when site visitors navigate to /site-2/wp-login.php, they will be redirected to the /wp-signup.php of the main site of your multisite network, where they can create an account.
Here is an example of that page:

Creating a user programmatically
In the code, the process of creating a user is the same – you can just run the wp_insert_user() from any site of the network, and that’s pretty much it.
$user_id = wp_insert_user(
array(
'user_login' => 'misharudrastyh',
'user_email' => '[email protected]',
'user_pass' => null, // you can provide a plain password as well
)
);You can read more about creating users programmatically in this tutorial.
User roles in multisite networks
Although users have the shared table in the database, as I already mentioned before, roles are set for every site individually and will be stored in the wp_{BLOG ID}_capabilities metadata.
The default roles are the same – “Administrator”, “Editor”, “Author”, “Contributor”, and “Subscriber”, plus the roles which are created by third-party plugins.
However, there is one more “role” which is a super admin role. Technically, it is not a role, but a separate setting for a specific user that grants that user access to the network admin dashboard. You can make a specific user a super admin from the network admin dashboard, the “Users > Edit User” page:

Or using the following code line, for example:
grant_super_admin( $user_id );It can also be done directly from the database.
Add Users To a Site
When you’ve created a user in your WordPress multisite network, this user most likely will not yet have access to some specific sites within the network unless it is a super admin user.
It means that in this case, the WordPress multisite management process implies one more step we need to make – to add our user to a target sub-site.
Now, let’s take a look at how it can be done.
Using a WordPress Multisite user management plugin
Is it possible to add users to every sub-site within a network manually?
Yes, of course, but if you have a lot of websites, then your user management process will quickly become overwhelming.
So, in this chapter, we will talk about my WordPress multisite user management plugin, which is Simple Multisite User Sync.
First of all, when registering a user via the network admin dashboard, you can select multiple sites you would like to add this specific user to:

Second, the plugin comes with a bunch of bulk actions, which allow you to select as many users as you need and add them to a specific site within a couple of clicks:

Programmatically
It is also possible to add a user to a specific site programmatically. In order to do so, we need to use a specific function, which is add_user_to_blog().
Here is an example of how to add a user with ID=1 to a sub-site with ID=4.
$user_id = 1;
$site_id = 4;
add_user_to_blog( $site_id, $user_id, 'subscriber' );This example is quite basic; if you want to dive deeper into it, check my other tutorial.
Misha Rudrastyh
Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.
Need some developer help? Contact me