Cookie Error when Logging In
Since updating WP yesterday, When users attempt to login to my WP site, they receive an error message:
“Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”
Cookies are enabled, and if you re-enter your login information on the same page with the error, you can access the site without difficulty. You will then never see the message if you logout and login , unless you clear your cookies, then it returns.
Never had the message before, and with cookies enabled in all browsers, you still see the message the first time logging in.
Any one else experiencing this or have a suggested solution? All help is appreciated!
Thanks niosus. but I can’t login to my site .
I know there is a way to back my site but i take much time .
If there is no solution or update I should install a new wordpress and import table of post meta & … to new DB.
so thanks for reply.
Everything happens inside wp-login.php, so you can use an old version (<3.7). I did not check if there were any other changes, so if there were security fixes or other changes you won’t have those. I recommend editing out those 3 lines. That will make sure everything else stays compatible.
@sos – 2013
If you have FTP access or any other form of access to the filesystem (cpanel, ssh, etc) just comment out the lines as I explained in my previous post. You will be able to log in again like usual. There is no need to reinstall wordpress at all.
THANK YOU, THANK YOU, THANK YOU, THANK YOU SO MUCH!
I have been struggling the last few days trying to figure out what broke on my site to cause this issue. I could only manage to find a workaround by directing myself to /wp-admin/and having the site then redirect me to log in.
Now it works without a hitch! Again, thank you for sharing this fix.
You are amazing!
I’m behind Varnish, too. Any thoughts on how to ensure this cookie get passed through to WordPress?
Thanks @niosus for posting possible solution, however, I found another way on which we do not need to hack the core file like wp-login.php as it will be overwritten when updated and besides testcookie have different security perspective. Here is what I did.
In function.php of theme I added:
//fix for cookie error while login. setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); if ( SITECOOKIEPATH != COOKIEPATH ) setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
Hope this will help others as it solved in my case.
@mirajas Sounds good, did you post a bug report on this behavior in WP 3.7?
I did the edit and pasted Mirajas’s hack into function.php. Now all I see is a white screen after login, browser stays in wp-login.php …. Any suggestions?
When I try to login to my dashboard it gives me the same error. I’ve verified numerous times that cookies are enabled. However, the second time I login after getting the error it logs in with no problem. I have tried across multiple browsers and OS platforms, and it’s all the same.
I’ve deactivated all my plugins and it still gives the error. I even tried reinstalling WordPress and it doesn’t fix the issue either.
I even verified that the test cookie downloaded to the browser.
@niosus‘s solution appears to have worked for me. However, what is strange is that I have another 3.7.1 site that works fine without commenting out the wp-login.php lines.
I should add I am also trying to login to my dashboard.
@willem.deboer Follow what niosus posted. If you did BOTH the login file and functions file edits that may be why it’s broken now
Obviously 🙂 No, I did just the functions.php edit. Moreover, amsgator is having the same problem.
My bad! 🙂 The wp-login.php hack worked for me. I guess I’ll roll with that until something else is figured out
Checked again, even restored wp-login.php from the original archive, just in case. Same white screen in two separate installs.
I put the hack in functions.php at the end, above the “?>”. Is that OK? I am familiar with programming conventions, just not with php.
- The topic ‘Cookie Error when Logging In’ is closed to new replies.