12

I decided to integrate several stand alone Wordpress websites into a single multisite installation.

I created a brand new multisite install with subdirectories, created a MU network site with subdirectory URL, and exported the content from the original standalone site, then imported that content into the subdirectory MU site.

I then removed the original standalone site from cPanel, and set the MU site's domain name to the original domain name.

The site loads on its original domain name, but when I try to login to domainname.com/wp-admin (using the brand new multisite's network admin user credentials), I receive an error:

ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

Cookies are enabled in Chrome.

I tried adding the following to wp-config.php:

define('COOKIE_DOMAIN', false);

but the issue remains.

The same issue occurs if I use WP Migrate DB Pro, to pull in a standalone website into a MU subdirectory site, then delete the standalone site from cPanel, and then set the MU subdirectory site's URL to be the original standalone site's domain name. The site's front end loads fine, I just can't login to admin.

Help appreciated.

  • 1
    Have you seen this answer How to set up Wordpress Multisite on multiple domains without plugin? – bueltge Mar 16 '17 at 13:41
  • Thanks @bueltge, tried adding define('COOKIE_DOMAIN', false); but logging into a sub-site with its own domain doesn't work - it loops back to the same login screen. – Steve Mar 17 '17 at 18:23
  • @Steve you should attempt specifically what the answer states and set it to an empty string, i.e. define('COOKIE_DOMAIN', '');. Boolean false may or may not have the same meaning as an empty string '', depending on the application. – bosco Mar 21 '17 at 23:42
  • By MU, do you mean you are using a domain mapping plugin? Thanks. – Greeso Mar 23 '17 at 4:25
  • No @Greeso, using the built in site URL functionality. – Steve Mar 23 '17 at 5:22

12 Answers 12

21
+50

First Clear Browser Cache (including cookies) + server cache from cache plugins etc.

Then set the following in your wp-config.php file:

define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', ''); 

Also, you may checkout the answer from HERE:

define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'your-domain.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('SUNRISE', 'on');

If it still fails, then read this answer or contact your server support, there may be a configuration issue in the server.

  • Hi Scott. A similar issue has arisen on another MU site. I've added the constants above to wp-config.php, but on this other MU site, childsitedomain.com/wp-login.php produces the error The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that define() line. Any ideas on how to tackle this situation? – Steve Mar 27 '17 at 10:53
  • If I comment out that statement, I receive the error after logging into the child site: ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress. – Steve Mar 27 '17 at 10:56
  • I've raised this issue in a new question. – Steve Mar 27 '17 at 11:03
7

Using WordPress version 4.9.4.

I was getting the cookie error and looked through various help options and eventually solved it by using a blend of Scott's fix:

Note: I didn't do any cookie cache clearing

a) Editing out sunrise.php line in wp-config.php (I was using native domain mapping so removed the MU plugin install changes that I'd made )

b) Adjusted my wp-config.php to

/* Multisite */

define('WP_DEBUG', false);

define( 'WP_ALLOW_MULTISITE', true ); 

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'www.mysite.com.au');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* define( ‘COOKIE_DOMAIN’, $_SERVER[ ‘HTTP_HOST’ ] ); */

define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

/* That's all, stop editing! Happy blogging. */
3

Finally after hours, literally, of troubleshooting I was able to get this resolved on the AWS Lightsail Bitnami Multisite Wordpress (WordPress 5.0.4) instance by performing the following:

  1. Ensure the WPMU Domain Mapping plugin is disabled
  2. Edit /opt/bitnami/apps/wordpress/htdocs/wp-config.php...

    a. Add the following:

     define('ADMIN_COOKIE_PATH', '/');
     define('COOKIE_DOMAIN', '');
     define('COOKIEPATH', '');
     define('SITECOOKIEPATH', '');
    
     /* That's all, stop editing! Happy blogging. */
    

    b. Comment out:

    // define('SUNRISE', 'on');
    

After these changes, login was successful - no errors. Thanks for everyone's input. If it was not for that, I would still be scratching my head.

I did find the answer here:

https://docs.bitnami.com/aws/apps/wordpress-multisite/configuration/configure-wordpress-multisite

This domain mapping functionality is included in WordPress Multisite since v4.5. If you’re using an older version, you will need the WordPress MU Domain Mapping plugin.

So it appears that the WPMU Domain Mapping plugin is unnecessarily included in the AWS Lightsail Bitnami Multisite package.

  • Thanks for this! It worked for me without disabling WPMU Domain Mapping plugin. I also did not find SUNRISE anywhere, so I didn't have to comment that out either. – Monarch Wadia Aug 19 at 22:08
1

I just finished troubleshooting a similar issue with subdomain multisite.

With:

define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']);

The site was still throwing a cookie error and in some instances of trying what was suggested above.........

define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', ''); 

This caused a different error to delete defines referencing "COOKIE_DOMAIN" upon visiting subsites.

Finally I was able to login after making sure both of these were defined just above the multisite network information

define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']);
define('COOKIE_DOMAIN', '');

Try making sure these are both defined. I hope this helps.

  • To clarify above, it seems to work with just define('COOKIE_DOMAIN', ''); – Ruben Apolinar Dec 6 '17 at 17:22
1

I commented out define('SUNRISE', 'on');

/* define('SUNRISE', 'on'); */
define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']);
define('COOKIE_DOMAIN', '');

Then, I don't see the below error message:

ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

Login also started working.

1

So I was having this issue as well and came across a lot of solutions like the ones mentioned here but they didn't work.

What did work was simply adding the following to the multisite configuration in wp-config:

define('COOKIE_DOMAIN', false);

so that the section in wp-config looks like so:

define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'your-site.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('COOKIE_DOMAIN', false);

posting here so that others may find it and spend less time banging their head against their desk than i did.

0
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
//define('DOMAIN_CURRENT_SITE', 'masterdigitalservices.com');
//define('PATH_CURRENT_SITE', '/');
//define('SITE_ID_CURRENT_SITE', 1);
//define('BLOG_ID_CURRENT_SITE', 1);

Here's my new wp-config. Looks like it got hardcoded to be a specific site, and wasn't letting other domains work -- only subdomains. Great answers here.

0

I was having this issue as well, and nothing I did helped. Tried it in Microsoft Edge, and didn't get the error.

So in my case at least, it was just Google Chrome causing the problem.

0

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

0

THIS FIXED IT FOR ME I had not setup WordPress fully for the new domain name. I had created my site subdomain.domain.com I then wanted to remain as newdomain.com over subdomain.domain.com This required

  1. WordPress network > admin > site, change site to new name (which I had already done, site was working)
  2. WordPress network > admin > settings > domains, add in new name to site ID and tick yes for primary domain (to indicate this name is the primary name). To find site ID, you can hover over the network > admin > site which will say which site ID you are working on. Hope this helps anyone who was getting the cookies are blocked or not supported message when trying to login Best wishes SamTapsell
0

I was able to resolve the issue after adding the below in wp-config.php. Reference

define( 'COOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'home' ) . '/' ) );
define( 'SITECOOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'siteurl' ) . '/' ) );
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
define( 'PLUGINS_COOKIE_PATH', preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) );
-1

Please try adding the following to your wp-config.php file

Also remove all cookies from your browser before testing

define( 'COOKIE_DOMAIN', $_SERVER[ 'HTTP_HOST' ] );
  • When I made that change, I couldn't log into any website, including the main website. – Steve Mar 17 '17 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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