I understand that, if I use subdomains on a multisite, then WordPress has the built in function of keeping the users logged in.
The different domains are a must. These sites were set up using the built in "add a new site" feature of WordPress. (I did not use a plugin to set up the sites.) The sites work fine as they are, except I would like for a user who signs into abc be able to switch to def to still be logged in.
I have tried adding define('COOKIE_DOMAIN', '');
to my wp-config file.
Also I've tried.
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');
and I've tried changing define('SUBDOMAIN_INSTALL', true);
between true
and false
. I've tried as many variations of the above as I can think of. The only other solution I've seen mentioned was a SSO plugin which would allow users to use their google or Facebook logins to sign in, but we are not comfortable with this option.
(A note: When I looked this issue up, some people were getting error messages about cookies not working/not being allowed and I have not noticed any error messages to that effect.)
I understand that, if I use subdomains on a multisite, then WordPress has the built in function of keeping the users logged in.
The different domains are a must. These sites were set up using the built in "add a new site" feature of WordPress. (I did not use a plugin to set up the sites.) The sites work fine as they are, except I would like for a user who signs into abc.com be able to switch to def.com to still be logged in.
I have tried adding define('COOKIE_DOMAIN', '');
to my wp-config file.
Also I've tried.
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');
and I've tried changing define('SUBDOMAIN_INSTALL', true);
between true
and false
. I've tried as many variations of the above as I can think of. The only other solution I've seen mentioned was a SSO plugin which would allow users to use their google or Facebook logins to sign in, but we are not comfortable with this option.
(A note: When I looked this issue up, some people were getting error messages about cookies not working/not being allowed and I have not noticed any error messages to that effect.)
I added this to my wp-config.php file:
define('COOKIE_DOMAIN', '.example.com');
define('COOKIEPATH', '/');
define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . md5('https://example.com'));
define('AUTH_COOKIE', 'wordpress_' . md5('https://example.com'));
Tip: Logout first, or you might have to delete all your browser cookies. Hope this helps.