Cookies blocked in WordPress

Bugs are often part of the development process and in WordPress there are also problems. A common error that often pops up in an installation of this famous CMS is when we try to log in to a website running with WordPress and it tells us that cookies are blocked.

A message similar to the following usually appears:

Cookies are blocked or are not compatible with your browser. You must enable cookies to use WordPress.

Contrary to what the error message indicates, this message does not necessarily mean that it appears due to blocked cookies. 
You will often get this error due to the involvement of a caching or security plugin on your site or a change of your server/IP address after migrating your website to another host.

Sometimes this error goes away just by refreshing the browser. 
Implement the following possible solutions if you see that the error does not go away.

Reasons for the error: Cookies are blocked or are not compatible with your browser

There are only a few possible reasons why your WordPress website is throwing a cookie error when you try to login to your site. Below you will find the two most popular reasons. It is a fairly simple error to fix.

WordPress login error caused by security or cache plugin

Security or caching plugins can interfere with your WordPress site’s cookie and login handling and prevent the WordPress user login cookie from being generated correctly. As a result, this may result in the error “Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”

To fix this, temporarily disable the Security and Cache plugin by renaming the plugin folder. To do so, you log in to your website via FTP or a file manager plugin , and then rename the specific  /wp-content/plugins/plugin-name folder to something else.

Then try to log in to the WordPress dashboard again. If this fixed your problem, please reinstall the cache and security plugin and let the developer of these plugins know about your cookie issue so they can fix it.

“WordPress cookies not supported error” after changing server or hosting service

If you migrate your WordPress website to another server while the domain remains unchanged, you may create a conflict between the cookies stored in your browser and the new hosting server. Therefore,  please delete all existing browser cookies  and try to log in to the WordPress dashboard.

Solutions to blocking Cookies in WordPress

Editing the wp-config.php file

You must paste a single line of code here, to remove this error. You can access the wp-config.php file via Filezilla in the root folder of your website, paste the code below at the bottom before it says 
/* That’s it, stop editing!…*/.

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

Then refresh the browser and you will be able to log in to your website again.

Editing the functions.php file

If the previous solution does not work for you, try this other option. We have divided this solution into three separate steps:

Step 1 – Open and edit the functions.php file

You can access and open this file using the cPanel file manager or via an FTP tool like Filezilla. After logging in, go to your website’s theme folder, where the  functions.php file is located . this is usually wp-content/themes/theme-name/functions.php

Step 2: Add code to the functions.php file

Copy the following code and paste it at the bottom of the functions.php file

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

Step 3: Save the file

After saving and loading the modified.php functions on your website, you should no longer see the “Cookies are blocked or not supported by your browser” error. You must enable cookies to use WordPress.”

Was this article helpful?

Related Articles

Leave A Comment?