How to share users and logins across multiple WordPress installs?

Recently, I found myself in a situation where I needed to add a bbPress and BuddyPress “section” to a website (we’ll call this site B), although the main website (site A) and site B were supposed to have different WordPress installs. Lucky for me, both websites would be hosted on the same server so this made it the whole scenario easier.

After I finished it and got it working, I decided to write an article on it to prevent you from some of the headaches I got while doing this. Also the process could be extended to even more websites, in my case I was only going to need to synchronize login details and cookies between two WordPress installs.


  • Site A and Site B must be on the same top level domain (subfolders or subdomains)
  • Site A and Site B will be using the same Database

Probably obvious, but you will also need FTP access to both websites, we will be opening and editing wp-config.php for both websites. If you meet the requirements, we can move on.

(Optional) Do a full website Backup

Since we’ll be working with wp-config.php and the databases, it’s best to be safe and run a full website backup, or at least the database and wp-config.php

For this I recommend using Updraft Plus or WP Time Capsule, but just about any other solution will work. I recommend them because I’ve used them many times and never failed me.

Sharing Users and User Meta

In order to have the same login and password on both websites, we’ll be using the same database tables. If you’re using the default prefix, these should be called wp_users and wp_usermeta.

1. Check Site A’s table prefix

If you don’t know for sure your site’s table prefix, open Site A‘s wp-config.php and look for this line:

In most situations, it will be wp_, but if yours is different just remember it because we’ll be using it for Site B‘s wp-config.php too. Keep wp-config.php open, we’ll be needing more info later, as well as to edit it.

2. Installing WordPress for Site B

Keep in mind we’ll be using the same database as Site A, so you will have to use a different table prefix for Site B. In my example, I decided to use com_, short from Community. You can use whatever you see like, it doesn’t matter.
If you’re using tools for automated WordPress installation that do not allow you to select the database and prefix, don’t worry about it as you can chance them later from wp-config. Just make sure you have WordPress installed in a Subfolder or Subdomain.

Open Site B‘s wp-config.php, and replace database name, user and password to be the same as Site A.

Now both sites will be using the same Database. Make sure Site B uses a different table prefix.

3. Share WordPress Users between the websites

To do this,  all we need to do is to make sure Site B is using the same tables for users and usermeta as Site A. Open Site B‘s wp-config.php and add the following lines right before 
/* That’s all, stop editing! Happy blogging. */

Please note that wp_ is Site A‘s table prefix, if yours is different you need update these lines.

Great job, both sites are now sharing the same users (if you did everything right).

Sharing Login Cookies

Now that both websites are using the same login details, you will notice that if you switch websites you will have to login again. That can be fixed by sharing login cookies, here’s how to do it.

1. Edit Site A’s wp-config.php

Right before /* That’s all, stop editing! Happy blogging. */, add the following lines:

In the first line, you will have to replace with your actual domain. In the second line, you have to put your WordPress Site Address (URL), which you can get from Dashboard -> Settings -> General

Don’t close Site A‘s wp-config.php yet, we’ll still need some info for Site B.

2. Edit Site B’s wp-config.php

Similar to how we did for the database name, user and password, we will now copy the following lines from Site A and replace those existing in Site B:

Obviously you won’t actually find anything in there names stringof40characters, but some different random strings of 40 characters.
Next, we need to make sure Site B is sharing login cookies with Site A.

Similar to the previous step we will now edit Site B‘s wp-config.php and add the same lines we added for Site A.

That’s it, you’ve managed to Share Logins and Users between multiple WordPress installs.