Cookie Error Cannot Login to WordPress

The dreaded cookie error from WordPress is something that I have encountered a lot and I wanted to show you how you can quickly get into your site if you ABSOLUTELY need to.

Why Does Error Happen

Screen Shot 2016-01-28 at 10.32.51When you login to your WordPress site a cookie is created within your browser that tells WordPress you are a logged in user.  However when there is some error creating that cookie then you will receive an error like this.

How To Get Around This Error

There is a simple and easy way to get around this error, but it is COMPLETELY unsafe and I HIGHLY DO NOT recommend that anyone do this to their live site, but that is up to you to decide ūüôā

You will need FTP access to your site’s files and the user ID of the account you want to sign in with. ¬†Once you have those two things please follow the ¬†directions below.

  1. Go to the /wp-includes/pluggable.php file
  2. Find the function wp_validate_auth_cookie (its around line 650)
  3. Add a new line to the function at the very top that returns the ID of the user you want to login as.  So if I wanted to login as the user with ID of 1 I would do return 1;at the top of the function.

Here is what the function would look like after you add the code.

After you do this you will simply just be logged in as that user and so will EVERYONE else visiting your site. This is why it is EXTREMELY unsafe and I do not recommend doing it in any normal circumstances.

Leave a Reply