I Have Wordpress Multisite as Following

  1. multisite on domain.com

  2. multisite on sub1.domain.com

  3. multisite on sub2.domain.com

  4. multisite on sub3.domain.com

    X multisite on subx.domain.com

  • All Sites are on Same Database. ( If There Is Way to Use Different Database it Will also Work )

  • I am using domain.com's user and usermeta table for all other subx.domain.com by adding following code on all other multisite

define( 'CUSTOM_USER_TABLE', $table_prefix.'my_users' );

define( 'CUSTOM_USER_META_TABLE', $table_prefix.'my_usermeta' );

and using

  • " User Session Synchronizer " for Handling Login-Logout Cookies

  • Everything Works Fine Only Problem I am facing is
  • my user role is not synced what I mean is

If Someone Create account at domain.com or any subx.domain.com account is also created at all other subx.domain.com


Any other subx.domain.com Multisite Don't have user role so they can't do Nothing on any other Multisite

What I Want to Do ?

  • I want to Duplicate same user role at every site in Real Time.


  • I want to use same user and user meta for all site meaning that everysite will use same usermeta capabilities it will be more useful for me because I want to use mycred plugin and I don't want any issues** ( More Useful )


So for example I have account with editor role at network site I also have account on other network site but I am not editor there even I don't have any role there my any network site needs to be same role because my multiple multisite network works in that way

if you would say why I or anyone need that kind of setup ?

  • Ans: I have similar site as stack overflow it is totally different from stack overflow but the way it works is same so if you sign up on any sub site of stack overflow you will have access to all subsite with same account and but I also want role to be same & also want global point system
  • A network of networks would do the same thing, as would a single multisite that had a domain mapping plugin. Also roles and capabilities are stored in the database in their own table, not in the user table. I'd advise figuring out a way to simplify your setup
    – Tom J Nowell
    Commented Apr 13, 2017 at 11:24
  • @TomJNowell thank you very much. can you explain in detail ? Do have any idea how to setup ? I tried everything I found on web only this works for me 🙁
    – Maharshi
    Commented Apr 13, 2017 at 11:34
  • A multisite install by default has a single network of sites, most users are unaware of this as there is no user interface for networks, and it's code that very few people use. Having said that, a single multisite that has a domain mapping plugin might work for you by letting you choose any URL for a site, not just a subdomain or subdirectory, for example my site tomjn.com is also tomjn.co.uk and tomjn.blog, they're the same install, and the same site, but with domain mapping. Without further information about how your site is set up, and why it's set up that way I can't say much more
    – Tom J Nowell
    Commented Apr 13, 2017 at 12:03
  • Also keep in mind that user roles are site specific, they're not shared across a multisite, so sharing them across multiple installs doesn't make any sense as a statement. Keep in mind too that super admins are not a role or capability, they're an flag set in a site option
    – Tom J Nowell
    Commented Apr 13, 2017 at 12:05
  • I am not using same site which is accessible using different domains it is completely different site and site types are also different so domain mapping will not work for me
    – Maharshi
    Commented Apr 13, 2017 at 12:09

2 Answers 2


I want to use same user and user meta for all site meaning that everysite will use same usermeta capabilities it will be more useful for me because I want to use mycred plugin and I don't want any issues** ( More Useful )

This is the crux of the problem, specifically:

everysite will use same usermeta capabilities

Every site is already using the same user and user meta, the problem is that roles and capabilities are not stored in user meta! They have a separate table

So What if I shared the roles tables too?

That won't work. If the roles table says you have editor status on site #3, we now have a problem because you have multiple multisite installs. Does it mean site #3 on sub1.domain.com? Does it mean site #3 on sub2.domain.com? There's no way of knowing

The Problem Runs Deeper Though

Roles and Capabilities are not install-wide, they're site/blog-wide. I can be an editor on a blog, but an admin on another blog within the same multisite install.

For example, WordPress.com is a giant multisite install. I can create a site and be an administrator of that site, but I don't have admin access to your site.

By default, if I log into a site, I do not have a user role, which is intentional.

The Misleading Super Admin Functionality

Super Administrators aren't roles. Each blog has an options table, but there's another options table that exists across an entire multisite. Inside this is an option with a list of User IDs, this is what determines if you're a super admin or not.

If your User ID appears in this option, you can do pretty much anything, and it will override and assume you have a capability. It's a little more involved than that, but that's a good approximation. You won't find a super admin role in the roles table.

So How Do I Build A System Where I Give a User A Role That is Everywhere?

A universal role, that you set once, that's set everywhere? This functionality doesn't come out of the box, and is counter to how standard WordPress works ( and may have unanticipated side effects ).

At a fundamental level, what you've been building is single sign on, but through a fragile system of shared user tables.

So you will need:

  • Somewhere to store the role set for the user
  • Code to read that and set it programmatically, ignoring the user table
  • Code to provide a User interface for setting the role
  • A list of what roles you want, if a plugin adds new roles then those will not be usable unless it's added to all sites across all installs

I would suggest storing the role in user meta, and using the user edit profile screen. You will also need code to check the roles and capabilities to prevent users changing their own roles. Pay very careful attention to this code as it will be a critical security failure point.

Sadly, doing this may be either difficult, or expensive:

  • The WP_User object doesn't provide easy filters, it may be necessary to note down a role and all its capabilities and provide your own WP_User replacement, this could well cause compatibility problems
  • You could check on every page load if the users role matches what it's meant to be, and set it if it isn't. This would be more expensive, but more reliable and more compatible

I would note though, that all of this is going to be costly to maintain. Your setup has pushed you into a corner of high technical debt, and this is one of the costs.

How Other People Do It

When you rebuild the system in the future, consider a SSO/Single sign on system. Federated login such as those provided by OAuth or SAML is the longterm answer here. IN that scenario you would provide the authentication level to the site when the user logs in ( the login may be a seamless redirect if the user has already authenticated with the SSO provider ), then set the appropriate role when the user is passed back to the site.

It is true, that you would no longer be sharing user tables across installs, but any information that needs to be synchronised would be set at the central SSO provider and pushed to the relevant sites.

  • That wasn't mentioned in the original question, and there's no need to shout or be rude, I'm trying to help, I'm not paid to do this and we're all volunteers on this site. I don't see why SSO would be incompatible, but the SSO part of my answer is just the paragraph at the end, it looks like you ignored the rest of it including how you would do it without SSO.
    – Tom J Nowell
    Commented Apr 13, 2017 at 15:29
  • sorry I didn't mean anything like that I am Indian and English is not my main pan so I am weak in English so it is possible that I said something wrong so sorry for that I will remove that now
    – Maharshi
    Commented Apr 13, 2017 at 15:31
  • @Maharshi the "So How Do I Build A System Where I Give a User A Role That is Everywhere?" section tells you exactly how to do it, and is the answer to your question. Wether it will work with mycred is out of scope of this site, and would make your question impossible to answer ( and would add up to a huge amount of paid work if done for free, far too much to fit into an answer, what you've asked is non-trivial and difficult to do )
    – Tom J Nowell
    Commented Apr 13, 2017 at 21:09
  • Can you tell me which table is used for storing capabilities ?
    – Maharshi
    Commented Apr 14, 2017 at 3:36
  • I Found Something on Web is this possible for my case please check it : kinsta.com/blog/share-logins-wordpress
    – Maharshi
    Commented Apr 14, 2017 at 4:07

I just got this on Web this works for me it need some work


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.