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.)

  • Have you tried this answer?
    – Aurovrata
    Commented Apr 27, 2018 at 7:32
  • it didn't work. I logged into the main domain and when I switched to a different one it asked me to log in again. Commented Apr 28, 2018 at 19:42
  • its important when you change cookie settings to clear your cache properly before testing any changes as your previous cookie will be cached. Keep in mind also that if you already have a live version of a website and you are upgrading the cookie settings to change your salt keys. this will ensure that previous visitors browsers will refresh their cookies.
    – Aurovrata
    Commented May 1, 2018 at 8:26

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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