When you can’t log into WordPress because your “Cookies are blocked”

Cookies blocked in wordpress error message.

But your cookies are turned on, you’ve cleared them along with the rest of your cache, and the problem exists in every browser!

A typical scenario is when you’ve copied your website from it’s test URL to production, or maybe you’re even just syncing down your prod data to your dev environment, as I do every once in a while to make sure I’m writing code against realistic data sets.  After restoring the copied site files and importing your MySQL database dump into your dev db, you innocently try to navigate to your /wp-admin page and log in.

And you can’t log in because of some weird errors like “Cookies are blocked” on your system … frustrating.


When you find yourself unable to log into WordPress, don’t panic.  Just go through the first few logical steps to make sure:

  1. Make sure you’re really at the right URL. No kidding, we all work on a million websites, just make sure your browser didn’t auto-fill your address bar with the wrong URL – it happens, admit it and let your coworkers make fun of you, then go on about your day.You might even be at the correct URL, but your hosts file is redirecting you to a server you’re not expecting.  (Touched your hosts file lately?)
  2. Reset your password.  The forgot password route is super easy, and with as many passwords as we all tend to juggle, it’s probably faster to just reset to something you’ll remember instead of spending an hour trying every combination of letters/numbers/symbols you’ve ever tried to memorize throughout your computing life.
  3. Check for error messages. But beware, error messages can be deceitful.  For example, if you’ve moved or copied your blog to another location with a different URL, you may need to do some blog triage (described further below!).  Also, you might want to try turning WP_DEBUG on in your wp-config.php file, as it may reveal more info that is helpful in troubleshooting.  Remember not to leave this on in production, though!  Read more about debugging WordPress.
  4. Disable your plugins by renaming the plugins folder.  Doing so has minimal impact, and is an attempt to remove any other non-WordPress-Core code from loading and further get to the bottom of your login issues.  Also, try renaming your active theme folder (the folder under the /wp-content/themes directory) to get WP to fall back to the default Twentyeleven theme.You’ll need to go back in and reactivate each plugin later, but is a good troubleshooting step!

This won’t solve every problem out there, but it’s a good start.  In fact, it was when my normal checklist failed and I found a more unique fix for W3 Total Cache issues that I decided to write this post.

W3 Total Cache

If you have W3 Total Cache installed, this could be causing your login problem – especially if you’ve recently moved your blog or otherwise updated it’s URL.  Admittedly, this just sucked 30 mins of life away, so this was one I wanted to share specifically.

W3TC adds and modifies some files which can be problematic, so you probably just want to triage your html_docs folder when moving your blog and using that plugin.  If you’re unable to log into your website, often seeing a “Cookies are blocked” error message as a symptom, you may need to disable and remove the plugin before you can get into the site.  (You don’t need or want a caching plugin in your dev environment, anyway!)

To disable and remove the W3 Total Cache plugin manually:

  1. Navigate to your /wp-content/plugins folder and delete the w3-total-cache folder.
  2. Also, delete the w3-total-cache-config.php file from /wp-content.
  3. Open your wp-config.php file and look for a line of code to comment out or remove:[sourcecode language=”php”]define(‘COOKIE_DOMAIN’, ‘www.your-website.com’); // Added by W3 Total Cache[/sourcecode]This is the line that causes those confusing cookie errors!
  4. You will still have your settings in your database, and should you choose to re-install the plugin, your settings should still be there.  You could also choose to manually go in and prune the W3TC options from the wp_options table in the database, but it’s not a requirement.
  5. Additionally, I like to go to the Settings > Permalinks options page and just click save again to force WordPress to rewrite the .htaccess file.

If you have further problems, feel free to leave a comment below!  Find another special case of a plugin causing login issues?  Leave a comment and help prevent somebody else’s hair loss  🙂

Or, check out one of the following pages where more discussion on the topic has taken place:

Author: Grant Norwood

Designer of things you click. Vegetable rights activist. Volunteer with tiny humans. Austin-ish, Texas.

People describe me as a rad web developer, product manager, solutions architect, public speaker, volunteer, and non-profit board member.

12 thoughts on “When you can’t log into WordPress because your “Cookies are blocked””

    1. Is the COOKIE_DOMAIN constant set in your wp-config.php, or any of your theme files? Verify this is not set, or set to the correct domain and sub-domain, by outputting the variable to one of your pages as a test.

      You can also try looking at all of your cookies in Chrome or Firefox and making sure you find various “wordpress_” or “wordpress_logged_in_” cookies with your correct domain and sub-domain.

      And of course, make sure you (or your browser tools, like Chrome Dev Tools or Firebug) have actually disabled cookies in your browser.


  1. Hi, Ive been having troubles with this,… first, i migrated changes from my pc to a “show” server; the admin side went blank. So Ive googled around for a solution, and tried all the common issues: blank spaces, plugin interference, etc. I’ve never liked the use of plugins, so Ive been cutting down to 3… So, Ive decided to start fresh: deleted the folder on my server, and deleted the tables from my database. Downloaded the latest wp version (3.9.1), installed it to the letter, changed ONLY the critical data on wp-config (server, user, password, and db prefix) and tested, wp worked ok. Went to admin side and nothing. blank screen. Its a fresh install!! so Ive tried again, deleted the folder and created a new one with another name. followed all the steps again, same result. So,I deleted the folder again, the tables and this time downloaded the previous wp version, 3.8.2, installed it and the result, again, is the blank admin page. And WP insists that my cookies are off, I’ve checked (each time) and they are Ok.
    I have two or three sites on that server, I thought that it could be the server; but all the other sites are ok. The htacess? no, it doesnt exists; early this year I had troubles with it, but fixed it for each site.
    Im running out of ideas… or maybe I havent looked throroughly enough…

  2. I could resolve this issue by removing wp-config.php and .htaccess files( taking backup of it ) then recreating it from the WordPress interface by visiting the WordPress site and after creating it restored these new files with old files.

  3. Hey, I just wanted to say thank you.

    I have had this problem intermittently for more than a year, through to the latest versions of WordPress. As soon as I read this page, I knew it would be the define(‘COOKIE_DOMAIN…. etc) line that W3 is adding into wp-config.php that was causing the problem.

    For future trouble-shooters, I removed that line, and did none of the other steps above regarding manually removing W3, and my problem was solved.

    Thanks again.

  4. Thank you so much. After I installed and setup W3 it kept giving me a blank page when I tried to login. I followed your steps and it was still doing it, so I followed the first link at the bottom of your post and deleted the .htaccess file from public_html folder and it worked!


    Is there a way to setup W3 to not give this error?

    1. There’s not really a way to prevent W3 from behaving this way if the issue existed in your .htaccess file, even if W3 wrote/updated that file.

      However, be sure to go to your Admin > Settings > Permalinks page and simply click the “Save” button to ensure that WP properly regenerates the redirect rules in a new .htaccess file!

    2. Ah ok. Guess I’ll just leave everything the way it is for now. Yup, I saved the permalinks page. Everything is working fine now. Thanks!

Did you know you can leave a comment?

%d bloggers like this: