I have a WordPress Network setup with subdomains and am having trouble with the logins. I thought at first it was an issue with a custom plugin I'm developing, but the problem persists even after disabling it (and all plugins, custom themes).

I have the WP login form on a site page (site3.example.com/testing) - users need to be logged in to access the testing page. They can log in through wp-admin, but I don't want them accessing the admin so they're redirected to the testing page anyways. The issue is, after submitting the signup form they're simply sent back to the same page not logged in. No error message are created and I've verified the login credential are correct.

I think the issue stems originally from my plugin. It uses user credentials all from site2.example.com - the idea was to keep all the plugin content in one WP site and extend a restricted portion to site3. To get the logins to work this way, I set define('COOKIE_DOMAIN', false); in wp-config.php - is that advisable? Now even with the plugin disabled, the cookie or history is possibly conflicting with the login?

Also of note; My main site is on primary.ezample.com and my sub sites are site2.ezmaple.com etc. Not the default {subdomain}.{primary domain} structure. This is because my example.come site is not in WordPress so WP needed to not override it. (I did this by manually updating the wp_blogs links in the database - works well enough unless it's the probable cause of this bizarre issue)

Logins for admins and other roles work fine on each other WP Network site, just not the trainers since they are redirected to site3.

Interestingly, everything works fine in a clear history, empty cache browser. Ctrl+F5 hard refresh doesn't do it, it needs to be an entirely new browser session. Naturally, not all of my users want to do that, so I'm looking for possible ways to program a fix in the site itself.

3 Answers 3


It seems it is a Cookies issue. Setting define('COOKIE_DOMAIN', ''); and define('COOKIE_DOMAIN', false); seems to work fine, but users had old cookies stored as well - so WordPress was seeing multiple login credentials in the cookies and redirecting to wp-login.php?reauth=1, forcing a new login.

I'm trying to re-set the cookies to expire for them, but since it's a slightly different domain string I'm not able to? Not sure why..

So the solution seems to be, get users to clear their local cookies. Now I'm also using a maybe more clearly documented define('COOKIE_DOMAIN', '.example.com');.


What is happening here is that many browsers now block third-party cookies (cookies from another domain).

So, if you're logged in into the WordPress' multisite admin (let say multisite.example.com) you have the cookie for it saved (the PHP COOKIE_DOMAIN constant is defined to multisite.example.com) and, if you try to log in into subsite1.example.com, the browser refuses to use the saved cookie for subsite1.example.com because it is "from a 3rd-party site".

The solution:

You can set the PHP constant in wp-config.php to be a wildcard (define('COOKIE_DOMAIN', '.example.com');) or simply let it void with define('COOKIE_DOMAIN', '');.

Second step is to clear the cookies for the involved sites and then the logging on both sites should work as expected =)


Strangely it worked for me (on more than one multisites) to set SUBDOMAIN_INSTALL to false. To be honest, I hadn't had time to investigate further why ...

define('SUBDOMAIN_INSTALL', false);

  • not working for me Commented Oct 4, 2018 at 10:13
  • 1
    It works, but it's not the solution if you manage a "per subdomain" multisite WordPress as you have to change it in wp-config.php to "true" if you want to create a new site. The solution is to add define('COOKIE_DOMAIN', ''); (or even better define('COOKIE_DOMAIN', '.example.com');) to your wp-config.php and clear the cookies for the involved sites on your browser.
    – call0fcode
    Commented Jan 12, 2021 at 14:08
  • 1
    My comment is rather old ;) I know, that it was quite strange that this worked at that time and I know that this couldn't be the "real" solution. I added the comment, because it could have help others, too. Commented Jan 13, 2021 at 15:19

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.