Have you ever set up a multisite network, started working on setting up a new subsite, and then get the cookies are blocked login error?
I have, and it really didn’t make any sense.
The first thing I looked for was my browser’s cookies settings. First, I made sure cookies were enabled. Then I checked that cookies weren’t blocked on the site I was trying to log into.
How to check if cookies are enabled
Each browser is a little different, so I’ll break it out by some of the more common browsers.
Chrome
- Click the three dots at the top right side of your address bar.
- Select Settings.
- Scroll to the bottom and click Show advanced settings…
- Under Privacy, click the Content settings… button.
- Make sure the button next to Allow local data to be set (recommended) is selected.
- Make sure the check box next to Block third-party cookies and site data is not checked
- Next, click the Manage exceptions… button.
- Make sure the site you are trying to log into is not listed with a Block behavior.
- Then, click Done on both windows and close the settings.
Firefox
- Click the hamburger menu (three horizontal lines) to the right of the address and search bar.
- Select Options.
- Select the Privacy tab on the left.
- Under History, select Use custom settings for history under the Firefox will menu.
- Check the box next to Accept cookies from sites.
- Set Accept third-party cookies to Always.
- Set Keep until to they expire.
- Next, click on the Exceptions button.
- Make sure the site you are trying to log into is not listed with a Block status.
- Click the Save Changes button.
- Then, close your options tab.
Safari
- Select Safari, then Preferences, then click Privacy.
- Under Cookies and website data, select Always allow.
- Then, close the preferences screen.
For me, none of those settings fixed the problem. I was able to log into other WordPress sites with no problem, so cookies were enabled.
Cookie settings in wp-config.php
The fix for me came in adding a few lines to my multisite’s wp-config.php file.
<?php //Do not include the opening <?php tag //Place the following four lines somewhere before the "That's all, stop editing! Happy blogging." line define('ADMIN_COOKIE_PATH', '/'); define('COOKIE_DOMAIN', ''); define('COOKIEPATH', ''); define('SITECOOKIEPATH', ''); |
You may need to close your browser and try logging in again, but after that, you should be able to log in.
Susanne says
Does this still work for you?
Are you using domain mapping, and with or without plugin? Or subdomain? I can’t make this work. When I try this I get this message and a blank white page: “The constant “COOKIE_DOMAIN” is defined (probably in wp-config.php). Please remove or comment out that define() line.”
Scott DeLuzio says
Yes, this is still working for me. Actually, it’s working on this site right now. The domain mapping on this site is without a plugin. I can’t say for sure why it isn’t working on your site, but this support topic may help.
Robert Siegfried says
Hey, I am starting a web hosting business and this helped me fix the cookie error. Thank you for posting this, it was very helpful.
Scott DeLuzio says
I’m glad it helped Robert!
Valerie Woelk says
Scott,
I have been monkeying around with this error for a week, on a multisite created from an old blog installation sorted into different category dedicated sites. Lots of hours of work were lost when I suddenly could not log in to the admin area. Thank you!