Wordpress - Cookies in multisite where network sites have their own domain name

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.


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. */

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.

Tags:

Multisite