Background: had a working WordPress 3.7 site at olddomain.com.
I moved it to newdomain.com successfully, and in the process added this to wp-config:
define('WP_HOME','http://newdomain.com');
define('WP_SITEURL','http://newdomain.com');
Now when I attempt to login from newdomain.com/wp-admin I’m getting the cross-browser error (despite having cookies enabled and clearing existing cookies):
ERROR: Cookies are blocked or not supported by // your browser.
You must enable cookies to use WordPress.
I tried going into wp-login.php and commenting out the following lines (744-747) to stop the conditional testcookie check
// If cookies are disabled we can't log in even with a valid user+pass
if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
$user = new WP_Error('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by // your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
else
$user = wp_signon('', $secure_cookie);
but doing that leaves me stuck in a redirect loop back to the admin page:
http://myapp.com/wp-login.php?redirect_to=http%3A%2F%2Fmyapp.com%2Fwp-admin%2F&reauth=1
Do I need to change (or not set) the site URL? or is there another potential way to troubleshoot this? thanks
add to wp-config.php
original source http://wordpress.org/support/topic/cookie-error-site-not-letting-me-log-in
Having migrated hundreds of WP sites, here’s a few thoughts :
If migrating the DB : Check the database options table (probably wp_options) column “option_name” that values “siteurl” and “home” have the correct “option_value” for your site. “siteurl” is huge.
I can testify that the options table tweak is the bare minimum required to migrate a DB to a new domain in WP. (will not cause redirection, will still have issues)
WP looks up these DB options to serialize the site to domain and I am pretty sure the defines are lower in the stack and of no help. Consider the wp-admin activities as loosely coupled to the front. You can break everything (done it) in the front and the admin will still function.
Also – did/does the site work with generic install/no migration or tweaks?
As mentioned – .htaccess (missing or misconfigured) will cause your error. Regarding the .htaccess file, if used, this is a dot.file and many operating systems will “ignore” or “make invisible” so a copy/paste or FTP application or similar may not carry the .htaccess
(pretty sure on this) If you moved the DB and used pretty urls, and missed the .htaccess that could be all you need to fix. I just tested locally on a sandbox install and the table wp_option column “option_name” value “permalink_structure” when left blank in column option_value will return to ?p=1 (non-permalink) status and .htaccess will be mostly bypassed.
This worked for me.
//define('COOKIE_DOMAIN', 'www.domain.com');
in your wp-config.phpThis error also occurs when moving a multisite installation to a new domain if you update all options on the database table (usually
wp_options
), but forget to change theDOMAIN_CURRENT_SITE
line onwp-config.php
:I experienced this due to my caching plugin.
W3 Total Cache had added the following to my wp-config.php file:
Since it was hard coded, it didn’t update to the new site domain. After deleting the added code (because I don’t currently use the plugin), I was able to log in again.
I’d check wp-config.php for the word “cookie” to see if a plugin might have added something like this.
I was getting this same error.
I had hard coded the Home and SiteURL in wp-config.php for a brand new website – no plugins even installed.
The problem: I had a space at the end of the URL.
Removing the space fixed this error.
this bug was driving me crazy the last couple of days so i thought after fixing it to share with you guys! the problem was when i was trying to login into my wordpress backend i got this annoying cookies error so this is how i fixed it!
Cheers!
I have been googled & tried all ways to get rid of this cookie issue. Finally i found two solutions, which could help you.
Solution 1:
yoursite/wp-login.php
Comment following lines 770-773
Code
It might work for some websites and some sites may show blank page. Moreover, this is not recommended,as this file may be overridden after wordpress update so try for second solution.
Solution 2:
yoursite/wp-content/themes/yourthemeFolder/functions.php
Place following code.
Updating of your theme may also loose these changes so please place this code in another functions.php, which is under your child-theme folder in your current active theme. Hope, this will help you.
Assuming you are running on a Unix/Linux type platform – please ensure you have copied your .htaccess file from your original server and updated any references to the old domain within that file. It will be in the root of your wordpress deployment (if you are using it).
Either that or you may have a reference to your old domain somewhere in your wp_options table within the database.
Be forewarned that as you have moved from one domain to another, images and media locations within posts may need to be updated. You can either do that yourself directly within the database, use a find/replace utility or manually re-point your images within your posts. An alternative method to fix your post data is to export all your posts from your old site (from within the admin panel) – Tools > Export > All posts; then manually update the URL within that resultant file before importing to your new site.
All of this and much more is covered over at codex.wordpress.org. For more information see this link:
http://codex.wordpress.org/Changing_The_Site_URL
IMPORTANT NOTES:
If you are going to modify anything directly within the database, make sure you read the section that talks about GUIDs
If you are using Better WP Security, there are other things you may need to do, but based on what you are describing, I doubt you have it installed.
I had the same problem with very similar circumstances and spec.
Eventually after trying all sorts of different solutions suggested online, I just renamed my active theme via FTP and then was able to login to the dashboard, I renamed my theme back and everything worked, I’ve no idea why but it may help somebody fix issues they’re having.
I had the same problem and nothing works. After upgrading my php 5.3.x to 5.4.x it works fine.
Following step solve my issue
on wp-config.php
Delete following files from wp-content
I created my Multisite install long ago when you needed a plugin for domain mapping. So I had the file
'/wp-content/sunrise.php'
and in the wp-configdefine( 'SUNRISE', 'on' );
It’s been working just fine until a recent update to WordPress.I viewed these errors in my debug.log:
So I deleted the sunrise file and wp-config sunrise definition and added @max4ever/@duck_boy’s cookie definitions to the wp-config file:
That solved the problem. I can now login!! Note: I tried this definition and it worked as well. Taken from Multisite Setup Guide
I came across this error when trying to install a wordpress site on localhost. The problem was this line inside the .htaccess
It prevents cookies being set if not on https. Just had to remove the line.
I have found very good solution of this issue
There are possible following solutions for this error
Check this article: https://www.scratchcode.io/cookies-are-blocked-or-not-supported-by-your-browser/