Use a single Users table for multiple WordPress sites

Using a single users table for WordPress seems like an easy task at first. You add the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE constants to your wp-config.php file and you are apparently off to the races; or are you? What seems like a simple task becomes more involved when we realize that WordPress doesn’t handle creating user roles (and permissions) in a graceful way, when we use custom user tables. So, if you’re one of the many that are left wondering why you are getting an error message that says:

You do not have sufficient permissions to access this page

this video is for you. By the end of the video, you should have a better understanding of how WordPress deciphers roles and permissions, and what we need to do to help make sure we are getting the final experience that we expect.

Related Links

WordPress Codex: Editing wp-config.php
WordPress Plugin: WP-Orphanage Extended
  • Ricardo Miller

    This is exactly what I am looking for. I am about to try it now because a client of mines have 5 WordPress install and they want the users to be the same across all 5 sites. At the moment all 5 sites have independent database. luckily for me 4 of the sites are currently empty and will delete those and link them to the main site database which isn’t empty. Hopefully your example would work.
    Thanks for the video will let you know if it does work on all 5 sites

    • Mike McLin

      Glad the video helped. Good luck with your implementation.

      • princessbritannia

        yeah super thanks its working so far on all five sites. I had to do it the long way round though. But never the less its working thanks again

  • joshdream

    What if the two websites are already installed and on two seperate databases?

    • Mike Cross

      this will not work with separate database database. but to tell you the truth, i can’t get it to work with same database. i was hoping you came up with some type of solution.

  • Алексей Суворов

    Thanks a lot for that. But do you really think that everyone want to watch 20 min video?
    Please write the manual.

    • Mike McLin

      Nope, probably not. I actually plan on redoing the video. I think keeping videos under 10 minutes is a usually a good goal. If something needs to be longer than that, it should probably be broken up into a series of multiple videos. I think the issue with this video is I didn’t plan it out properly, and I think some time is wasted.

  • Ethan

    Great help… Thanks a ton :)

  • lasitha

    thanks it was great help for me…

  • Branko

    Great video!
    Can you helpe me with this: I’m looking for how to let those users who registered on a first site be automatically be registered on my another WordPress site. In this case, the users don’t need to register again to the wordpress site, when already registered to first site. This means that they have a single account on all sites. First site is php, html, css, and new one site is in WordPress. Thank you.

  • Todd Griffith

    Fantastic, Mike, many thanks for sharing this!

  • Jay Stebbins

    will this work on a second WordPress installation on a sub-domain of the main installation?

    Thank you


  • Corey Lee Demerchant

    Will this work on 5 or more wordpress sites but also using a single blog table

  • Tarik Massac

    My second blog install keeps throwing me an error “Please provide a valid username.” but can’t figure out why – followed your steps to the letter but I can’t get past the second blog install. Anyone know a fix for this? (WordPress support blogs are of little help)

  • Nuarharuha

    if you have an issue like @tarikmassac:disqus, add the following variables inside ur wp-config.php for temporary and removed it after installation. There is no workaround yet.

    $_POST[‘user_name’] = ‘admin';

  • Eduardo Cardenas

    Hi Mike. Thanks for sharing this post. Everything is working for me, but not the wp-orphanage-extended plugin.
    It is not pulling the ROLE. It is setting them as default but not pulling the role.

  • A R Pavan Kumar

    hi, its saying

    Error establishing a database connection when i installed in the other server
    for example i installed and giving the same database details.

    defined in also

    define( ‘CUSTOM_USER_TABLE’, ‘pavan_usermeta’ );
    define( ‘CUSTOM_USER_META_TABLE’, ”pavan_usermeta’ );

    i am using WordPress 3.8
    Please let me know the problem

  • Adam

    Thank you so much for this one!

  • ebaiden

    so what if when i login on one site, I automatically get logged in on the other?

  • InterWall

    Hi, i have a problem. When i install second WP site, with other wp-config.php it saying:
    Please enter a valid username.
    But at the same time says that the user already has.

    Can somebody help?

  • Don Valdez

    This works perfectly, thank you!

    Just a follow up question to this:
    Is there a solution to sharing the same user table (or automatically propagating the data) when installs are on different servers? I think this might be possible if we specify the server location instead of ‘local host’ but i was also wondering if they can have separate databases and a plugin to copy the users of one install to another possibly using a schedule or cron like daily or weekly…

    I hope this makes sense.

    Thanks again for the wonderful tutorial

  • Mark Paris

    Great info, thanks for this detailed explanation.

  • BobQuentok

    Thanks! It works perfectly!

  • Edgardo

    In the ver. WordPress 4.0, when I put, the 2 lines code in the Site B, then in my tables have a “siteb_usermeta” … why? this table create automatic. =S and then I cant access to the dashboard’s site B.

    Can you help me?

    • Mike Cross

      the same thing is happening to me. Any time i put in the code, and i see it all types of different ways….., I can never log into my admin.

      I even tried the short way at the very end with the WP Orphanage and still i can’t get in. for 2 months, been trying to get this done.

      I have the 2 website on the same database and set under 2 different prefix. but i just can get the code to work and log into the back….PERIOD!

      Looking for help from ANYONE

      • Mike Cross

        I just got this to work today and now i am happy

  • Edgardo

    What do you think about this lines::

    define(‘COOKIE_DOMAIN’, ‘’); //replace with the 1st website url
    define(‘COOKIEPATH’, ‘/’);

    For have session in 2 or more webs.

    • Mike Cross

      did you ever get this to work?

      • Edgardo

        Yeah, but its very complicate, I chose WP Multisite, its better.

        • Mike Cross

          i could not get multisite to work for me. I also have to different site that need to have two site with in them. so i was working one with multisite and the other with database sharing.

          Also, now that the database sharing is working, you still have to login at the other site but atless you our members don’t have to register and have two passwords and all this.

          in multiste, so users have to login again once logged in to one site???

          • Mike Cross

            wow… i got this part to work also now. every time i talk to you, i find the answer….wow you are GREAT!!!!!……lolololol

  • James

    Mate! This is just perfect!

    I saw some comments about the video being too long.
    I will watch any length video as long as the content is quality and this is quality. You really take the time to explain things clearly and thoroughly. I tried to follow a blog post and it was just too short and skipping vital information.

    Now to find out how to get login cookies across two domains

    Thanks :)

  • Mike Cross

    hi we are using 4.2.4…. and for some reason… after trying to 2 months and i mean 10 hours each day of reading. We can’t get this to work. MAYBE this is not for newer WordPess?????
    Same database, and did 100 different check check and the checked. We are now trying new installs but this video does not explain too clear on how Mike got the new installed started and in the folders.

    So for us very very new beginners i am looking for closer step by steps, and lees explaining why. Being about to log into both of our web sites is so important to us…. I even afford to pay for this set up.

    Can anyone Help?

    • Mike Cross

      Never mind…. I just got it to work!!!!! so yes it does work on 4.2.4

      Thanks a lot for all your info.