How to Fix “Cookies are blocked or not supported by your browser” Error in WordPress

fix cookies are blocked

If you are a WordPress website owner, you may face the error that says Cookies are blocked or not supported by your browser and you must enable cookies to use WordPress. While trying to log into your WordPress website, you may run across this problem.

In this post, I will try to solve all your problem related to this error. Just stay tuned.

Reasons Why This Error Happens?

According to the error message, this message does not necessarily mean it arises because of blocked cookies. There can be several reasons, but the most common reasons are:

Cookies blocked by a security or cache plugin

Cookies can be blocked by a security or cache plugin and this is one of the biggest reasons. Your security plugins can interfere with login and cookie handling and end up blocking cookies. Thus you get to see “Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress”.  

To fix these you may deactivate your security or cache plugin and see if it works.

Cookies blocked after changing hosting providers

If you have recently migrated your WordPress site to another server while the domain remains and does not change, it can make a conflict between cookies stored in your browser and your new hosting server. Therefore, it is wise to delete all the existing browser cookies and try to log in to the WordPress dashboard.

How to Fix “Cookies are blocked….” Error in WordPress

If the above simple solutions don’t fix your problem, try method 1 first. This method is most likely to work. If doesn’t try method 2, hope you won’t be disappointed.

Method 1: Editing the file wp-config.php

First, you have to connect your website with an FTP service like Filezilla. If you don’t know how to do it check this guide “How To Use FTP To Upload Files On WordPress”. From the file manager enter the root directory of your site and find the file “wp-config.php”. 

Open the file and add the following code to the file.

define( 'COOKIE_DOMAIN', '.domain.com' ); // change domain.com with your actual domain

Please Note: Make sure you add the code snippet above the below line. 
/* That’s all, stop editing! Happy blogging. */

The above snippet might not work on multisite. Therefore, you can try the below one.

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

This method ignores the requirement for site cookies to log in. If the first method doesn’t work then you may try this method, although this is not the ideal solution. 

Here, you have to open the functions.php file from your website. Navigate to Appearance -> Theme File Editor -> Theme Functions (funtions.php).

Now paste the following code. 

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

Click on the Update File button and your functions.php will be updated.

Conclusion

That’s it, I hope you learned How to Fix the Error “Cookies are blocked or not supported by your browser and you must enable cookies to use WordPress” easily. If you face any problems feel free to ask. If you liked the post share it with your friends and leave your thoughts in the comment box below. 

Leave a Comment

Your email address will not be published.