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:
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:
Do I need to change (or not set) the site URL? or is there another potential way to troubleshoot this? thanks
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.
add to wp-config.php
define('ADMIN_COOKIE_PATH', '/'); define('COOKIE_DOMAIN', ''); define('COOKIEPATH', ''); define('SITECOOKIEPATH', '');
This worked for me.
//define('COOKIE_DOMAIN', 'www.domain.com');in your wp-config.php
- Ensure that all the files have the ANSI format and not utf-8
I experienced this due to my caching plugin.
W3 Total Cache had added the following to my wp-config.php file:
define('COOKIE_DOMAIN', 'www.olddomain.com'); // Added by W3 Total Cache
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.
This 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 the
DOMAIN_CURRENT_SITE line on
define( 'DOMAIN_CURRENT_SITE', 'yourdomain.com' );
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.
define('WP_HOME','http://100.000.000.01/~acctname/wp '); define('WP_SITEURL','http://100.000.000.01/~acctname/wp ');
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!
- Go to your ftp and your domain.
- Afterwards go to your wp-contents
- Go to your themes folder
- Chose the theme that is active
- Look for functions.php of your teem and open it
- At the ende of the code you should see closing tag p> just remove it clear the spaces also and save it!
- Go to your domain.com/wp-login.php
- and try to login it should be fixed afterwards you can put the tag back where it was and save it again that was the solution for me this trick also fixes the white page problem in wordpress
I have been googled & tried all ways to get rid of this cookie issue. Finally i found two solutions, which could help you.
Comment following lines 770-773
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);
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.
Place 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);
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:
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
//define('WP_CACHE', true); // Added by W3 Total Cache Block this line //define("COOKIE_DOMAIN", "www.domain.com"); Block this line
Delete following files from wp-content
object-cache.php advanced-cache.php db.php