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?

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

    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?

  • 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.

  • 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 :)