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