I have 2 Wordpress installation: siteA and siteB. Each installation have their own wordpress database: databaseA for siteA and databaseB for siteB.

What I want is users on siteA can connect on siteB. I can't use CUSTOM_USER_TABLE beacause is 2 separate databases. However the database are hosted on the same server. So, how can I use the users table of siteA for siteB with my configuration?

  • you need to create APIs – Aftab Mar 15 '17 at 14:06
  • You cannot without writing your own custom plugin. And even then it wont be easy and you'll have problems making it secure. CUSTOM_USER_TABLE solves a similar use-case but requires both WP installations to use the same database instance but different db prefixes. – user42826 Mar 15 '17 at 15:30
  • I know for CUSTOM_USER_TABLE using the same database but different db prefixes. That's the big problem... I have 2 databases, not just one. – Tidjy Mar 15 '17 at 17:46

It's not possible in Wordpress to have shared users between 2 separates installations on 2 separated databases.

It could be possible just by hardcoding:

  1. hardcode WP_User class connect to other database and retrieve users from there
  2. hardcode get_metadata() function, that for wp_usermeta table connect to other database and retrieve users from there

but mentioned solution is not recommended of course, because it's not updateproof.


you can do it by making changes in wp_config file of site B On site A, let’s say it uses the ‘wp_1_’ table_prefix. For site B, you need to change the prefix from $table_prefix = ‘wp_1_’;


$table_prefix = ‘wp_2_’;

In Site B's config file add these codes:

define(‘CUSTOM_USER_TABLE’, ‘wp_1_users’);

define(‘CUSTOM_USER_META_TABLE’, ‘wp_1_usermeta’);

Also replace the salt keys in wp-config file of site A to site B

  • I don't think this would work with different databases but it may work with different prefixes. – Andy Gee Jul 31 '18 at 7:51

I was also thinking about doing this. So instead of having 2 different databases, you'd have just the one. And I know the table prefix can be different. So like wp_12 & wp_21 But I guess you need both salts to be the same on both sites?

I think with their issue is that it has 2 seperate DB's. So it would be best for them to make a new DB, and export the other 2 and import them into the new database. But that's providing that the table prefix is different for each site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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