Fix A Cookies Blocked Error in WordPress

  1. Set cookies
  2. Bypass Browser cookies
  3. Troubleshooting methods
  4. Enable browser cookies

If you recently encountered an Error: Cookies Blocked or not supported by your browser. You must enable cookies to use WordPress. I can bet it’s must be frustrating.

You know browser cookies are enabled by default and it’s just you who can’t log in to your own website.

Cookies Blocked Error on WordPress

Don’t worry, I will walk you through how to troubleshoot this error and login back to your website.

How to Fix A Cookies Blocked Error

I will show you a couple of methods to fix the cookies blocked error.

1 Set Cookies Domain

Okay, When you first see the error just refresh the browser and try to log in again. I had faced similar cookies error and sometimes, Page refresh fixes normally so, do this first just to make sure.

Next, you need to add the following code snippet is wp-config file.

// Set cookie domain for login cookies
define( 'COOKIE_DOMAIN', '.domain.com' ); // change domain.com with your actual domain

Make sure to add the code snippet above the line.
/* That’s all, stop editing! Happy blogging. */

If you are using a multisite and the above piece of code doesn’t work you can try this one.

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

2 Bypass Cookies

This is not an ideal solution it just kinda ignores the requirement for site cookies to login.

What you need to do is add the following code snippet to your theme’s functions.php file

setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
if ( SITECOOKIEPATH != COOKIEPATH ) setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);

HOW TO ADD PHP CODE

The Code Snippets plugin makes it very easy to not just add PHP snippets to your website but also manage all the snippets you add.

You can activate and deactivate certain snippets, and even adds notes about what they do. It even has better error handling to avoid the PHP error scenarios.

To install it, simply go to Plugins > Add New and search for Code Snippets.

The traditional or normal way to add PHP snippets to your theme is to add directly in your theme’s functions.php file.

However, make sure you are using a child theme otherwise you will lose all changes once you update your theme.

3 Other Troubleshoot Methods

Every WordPress site is different and if for some reason none of the above methods worked for you, Try one of the following methods.

  1. Delete the .htaccess file from your server, just have a backup copy in case you need it later. If this fixes the error go to site settings and save the permalink settings without any change it will create a new .htaccess file.
  2. Disable all plugins with the help of FTP rename the plugins folder to anything, It will disable all of your plugins and hopefully also fixed the error. Rename the folder name back to original and enable plugin one by one. Normally Caching or security plugins cause this kind of problem.
  3. Remove //define('COOKIE_DOMAIN', 'www.domain.com'); in your wp-config.php. If such code exists in your wp-config.php
  4. If you recently installed SSL plugin make sure it redirects to HTTPS properly.
  5. It’s rarely caused by an issue in your theme. You can rename the active theme folder name to anything and it will revert back to default WordPress such as 2019 and will fix the theme related problem. Delete and reinstall your theme if this was the cause.

Why are you getting cookies blocked error?

wordpress cookies

Well, there is no straight answer. Sometimes you encounter this error because of the corrupt .htaccess file, or after installing SSL certificate redirect to https:// is not properly configured.

Might be a problem with caching or security plugins such as All in one security.

Whatever the cause we will try to find it and I’ll show you how to fix Cookies Blocked Error.

How to Enable cookies

Even though I am sure it’s least likely to be a problem but just in case if cookies are off in your browser. Here is how you can enable cookies for a specific site in Chrome and Firefox.

1 Enable cookies in Chrome

Go to any website and click on the little padlock or page icon from the starting of the site link and click site settings as shown in the following screenshot (alternatively go to chrome://settings/content)

Cookies Blocked Error site settings

Now click the button Cookies (Alternatively go to chrome://settings/content/cookies)

Cookies Blocked Error chrome cookies settings

In Allow cookies section click on “Add new Site”

Cookies Blocked Error allow new site

Just add your site to the list here like this: [*.]yoursite.com and click the button DONE

Cookies Blocked Error add new site

Once done, you will be able to login via Chrome browser into your WordPress site by now.

2 Enable cookies in Firefox

Run the Firefox and click the Menu button from the top right corner and click Options

Fix A Cookies Blocked Error in Wordpress 1

Click the privacy tab, there you can see under History, Firefox will and select Use custom settings for history.

Now, set the things up as per as following screenshots

Fix A Cookies Blocked Error in Wordpress 2

So, now after following this article and make changes to your browsers as described, you will be able to troubleshoot the so-called WordPress error:

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

Hope you enjoyed this article. If you have any problem please comment below.

Comment below and Let me know If it works or doesn’t work and I’ll do my best to help you out.

4 thoughts on “Fix A Cookies Blocked Error in WordPress”

  1. Hello. Thank you. but the error is still there. One of my website’ is HTTPS which is not working and other websites are working which don’t have SSL certificate. Can you help me to resolve the issue?

    Reply
    • Hi Prince, I updated the article so it should work now. Also, make sure that redirects to https are properly configured. You can use plugins like Really Simple SSL.

  2. I tried both of the methods, ,none of them working, it still shows cookie block error

    Reply
    • Hi Priya, Please try clearing your browser’s cookies and cache and if you are using Cloudflare try disabling it.

Leave a Comment