I have a little question about Wordpress database.

I want to know: Can I change the wordpress pefix for only one table? Thet means I use on one Wordpress Page two Prefixes.

If it works how I want to work and anyone know how it works, please write what I can make that it works.

Why I need it? I have 2 Websites, on the first website can log in all users and on the second website can only log in a little part of this users. But the username and Password have to be the same.

Sorry for my bad English and thanks for the help! ;)

  • Are these 2 websites both WordPress? If so, have you consider using multisite? – Robert Dundon Aug 10 '17 at 14:52
up vote 1 down vote accepted

In wp-config.php for your second site, define the following two constants:

define('CUSTOM_USER_TABLE', 'yourfirstprefix_users');
define('CUSTOM_USERMETA_TABLE', 'yourfirstprefix_usermeta');

You'll have to add some custom logic to your second site limiting logins by user role.

  • Did you also know can I use this tabel in an other database? Thet means all users are in one database alone. (In this database are only the "user table" and the "usermeta table") – ocram Aug 10 '17 at 11:23

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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