Support » How-To and Troubleshooting » Cookie Error when Logging In

Cookie Error when Logging In

Viewing 15 replies - 16 through 30 (of 115 total)
  • 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.



    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!

    You are welcome:-)


    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);
    	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

    Ah, I see. Mmm.

    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.

Viewing 15 replies - 16 through 30 (of 115 total)
  • The topic ‘Cookie Error when Logging In’ is closed to new replies.