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 problems related to this error. Just stay tuned.

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

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 it doesn’t, try method 2; I 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.

Method 2: Editing The Theme Functions

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. 

Was this helpful?

Thanks for your feedback!

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

  1. Fredric Frennessen Avatar
    Fredric Frennessen

    On a multisite WordPress install, I resolved it by making sure the domain mapping was added for the site.

    The ‘ define(‘COOKIE_DOMAIN’, $_SERVER[‘HTTP_HOST’] ); ‘ didn’t work. It gave a message telling me to remove the ‘define()’

  2. Osho Garg Avatar
    Osho Garg

    Working, Thanks for sharing!

  3. Barry Avatar
    Barry

    I tried all these and still not working 🙁

    1. Istiak Rayhan Avatar
      Istiak Rayhan

      Please contact with your web hosting provider.

  4. Dallin Avatar
    Dallin

    Worked great, thank you for sharing!

Leave a Reply

Your email address will not be published. Required fields are marked *

Introducing New Table Block Plugin - Tableberg

X
Need help?