Share WordPress Login Cookies Between Two Subdomain Installs


I have two wordpress installs each on their own sub domain. and

I want to share the login information between sub1 and sub2. I already have configured them to use the same MySQL database, and they use the same database table.

I am able to log in on both websites with the same credentials.

Sub2’s wp-config.php file has the following code:

define('CUSTOM_USER_TABLE', 'wp_c_users');

define('CUSTOM_USERMETA_TABLE', 'wp_c_usermeta');

This all works great. My problem, is that the cookies are not being shared between the sites. Instead of sharing the cookies both sites just delete the others and create a new cookie.

I added the following code to both sub1 and sub2’s wp-config.php:

define('COOKIEPATH',''); // Replace with your initial domain name
define('SITECOOKIEPATH',''); // Replace with your initial domain name
define( 'COOKIEHASH',    md5( 'Y@^ET#UF!RG7#KQXP04^WF' ) );
define('COOKIE_DOMAIN', '');

When a user logs in to sub1, the cookie is created just fine, then when I go to, I am not also logged in on this site.

When I then try to log in to, it deletes sub1’s cookies and overwrites them.

How can I get these two wordpress installations to use the same cookie instead of overwriting eachothers??

Any help much appreciated!

Paul Hill 3 months 0 Answers 12 views 0

Leave an answer