WordPress Multisite: cookies blocked or not supported

Avatar

There are many support queries regarding the WordPress log-in error message: “ErrorCookies are blocked or not supported by your browser. You must enable cookies to use WordPress.” And there just as many possible solutions…

We found one case on multisite when using the new domain mapping feature that required an update to the wp-config.php file. You may find after mapping a custom domain to your multisite subdomain that it is no longer possible to get past this error message. In order to resolve this, add the following line to your wp-config file:

define('COOKIE_DOMAIN', false);

We’ve found that this seems to solve the problem.

Nine comments

  1. Avatar

    Thanks for posting on this issue. However, when I add that to the wp-config.php file I get the following error across all sites:

    The constant “COOKIE_DOMAIN” is defined (probably in wp-config.php). Please remove or comment out that define() line.

    If you have any other fix for this I’d be grateful to hear it.

  2. Avatar

    “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.” just reared its ugly face with the installation/spinup of new subsite yesterday. I’ve tried your suggested fix and also added the following code to the bottom of the functions.php file: setcookie(TEST_COOKIE, ‘WP Cookie check’, 0, COOKIEPATH, COOKIE_DOMAIN);
    if ( SITECOOKIEPATH != COOKIEPATH ) setcookie(TEST_COOKIE, ‘WP Cookie check’, 0, SITECOOKIEPATH, COOKIE_DOMAIN);

    Cleared browsers caches on several different browsers and on server and still I can’t log into that one new subsite. The other sites do not have the same problem just the new site.

    Any ideas?

  3. Avatar

    I think the real solution should be adding the following line to wp-config.php:

    define(‘COOKIE_DOMAIN’, $_SERVER[‘HTTP_HOST’]);

    • Avatar

      I tried to use that, but it didn’t work.
      I had to use the “define(‘COOKIE_DOMAIN’, false);” solution to be able to log into multi sites sub domains. Thank you for offering another solution to try though!

  4. Avatar

    Using WordPress 5.4
    define(‘COOKIE_DOMAIN’, false); or define(‘COOKIE_DOMAIN’, ”); or define(‘COOKIE_DOMAIN’, $_SERVER[‘HTTP_HOST’]);
    had no effect for the response cookie domain at the wp-login.php.
    I succeeded with
    define(‘DOMAIN_CURRENT_SITE’, $_SERVER[‘HTTP_HOST’]);
    in the wp-config.php
    Domain Mapping was not needed (and did not work at my site).

Leave a Reply

Your email address will not be published. All fields are required.