How to fix “WordPress Keeps Logging Me Out” Issue?

Aug 18, 2020

How to fix “WordPress Keeps Logging Me Out” Issue?

Aug 18, 2020

Wondering why WordPress keeps logging you out?

Don’t worry, we’ve been there, and fixed it!

You see, anyone who joins the BlogVault team is tasked with creating and maintaining a WordPress site. In doing so, one of us recently faced a problem where WordPress was repeatedly logging us out. 

So we embarked on the journey to find a fix! 

We found that there are multiple reasons why WordPress keeps logging out. In this article, we shall discuss each of these reasons and how to resolve the issue. 

Fixing “WordPress Keeps Logging Me Out” Issue

To solve the problem of being logged out constantly, we set out to figure out the root cause of the issue first.

Our research revealed that there are multiple primary causes for WordPress logging out.

We then explored each one in depth and tried and tested different solutions to resolve them.

In this section, we shall explore the primary causes of this and how to fix WordPress keeps logging out problem.

Note: We have listed the causes based on the order of probability. It is advised that you execute all these methods one by one to troubleshoot this issue. 

Primary Cause 1: Browser Issues

When you sign in to your Admin Dashboard, WordPress creates cookies in your browser. These cookies authenticate you as a user and your session inside the dashboard.

It essentially identifies you as the user who entered the correct username and password and keeps you logged into WordPress till you sign out.

 If WordPress is unable to verify a user trying to log in, it could log out the user. 

Why does the verification fail?

  • The Cookie Has Expired
  • The Browser Doesn’t Accept Cookies

Let’s take a deeper look at what this means. 

The Cookie Has Expired:

Cookies are set to expire either after a certain amount of time or when a browser session ends. Expired cookies are usually deleted by the browser. If the login cookie has expired, WordPress will not be able to authenticate the user. 

Solution 1: Clear Your Browser Cache

You can fix this issue by clearing your browser cache. Check out our article on How to Clear WordPress Cache for the exact steps to take for different browsers. 

Once you have cleared your browser cache, refresh the login page and try to log in again. 

Solution 2: Clear Browser Cookies

If clearing your browser cache does not fix the issue, then you will need to manually clear the browser cookies. Let’s explore the steps involved for different browsers. 


How to Clear Browser Cookies in Chrome 
  • Open the Chrome Browser and click on the three dots on the top right hand side. Click on Settings to access the Chrome Settings Page. 
  • Scroll down to the Privacy and Security section or click Privacy and Security from the menu on the left.
  • Click on Clear browsing data. From the box that opens, ensure you tick the option labeled Cookies and other site data. You can also customise how long back the data must be cleared from.
  • Now click on Clear Data. Based on the time range chosen, this will take a minute or two.

Clear Browsing Data in Chrome

Pro-Tip: Get to the “Clear Browsing Data” box directly by using this URL: chrome://settings/clearBrowserData

How to Clear Browser Cookies in Safari 
  • Go to Safari Menu > Preferences. Now click on Privacy.
  • Click on Manage Website Data present next to Cookies and Website Data.
  • Click on Remove or Remove all.  

If you are using Mozilla FireFox or Edge, follow these instructions on their official forums:

Your Browser Doesn’t Accept Cookies

Sometimes your browser might have been set to not accept cookies. This might cause an issue when you’re trying to log in to your WordPress Dashboard. 

Solution: Enable your browser to accept cookies

How To Enable Your Chrome Browser To Accept Cookies
  • Open the Chrome Browser and click on the three dots on the top right hand side. This will take you to the Chrome Settings Page.  
  • Scroll down to the Privacy and Security section or click “Privacy and Security” from the menu on the left.
  • Click on “Cookies and other site data”.
  • Under General Settings, disable the “Block all cookies (not recommended)” and “Block third-party cookies”. 

General Settings of Chrome Browser

How To Enable Your Safari Browser To Accept Cookies
  • Go to Safari Menu > Preferences. Now click on Privacy.
  • Disable “Block all cookies”. 

If you’re using Firefox or Edge, these resources can help you enable cookies:

How To Enable Your Firefox Browser To Accept Cookies 

How To Enable Your Edge Browser To Accept Cookies

Primary Cause 2: WordPress Cache Issue 

WordPress Caching is enabled to save time and server resources. It thus has a significant impact on your site loading time and user experience. It essentially stores a copy of your website static pages. This is stored on the browser or the server hard disk or the RAM depending on the size of the website. 

Sometimes the caching system might not realise that you’ve made changes to the website content. It may show outdated content or misbehave to log you out repeatedly. 

Solution: Clear your server cache and caching plugin cache. 

You can go one step further and clear cache on your reverse proxy system and clear object cache. What are those, you ask? We have explained it all in this article here: How To Clear WordPress Cache

It is always advised to backup your site before you clear plugin cache or make any code changes. Use a reliable cloud-based backup plugin like BlogVault which has a 100% restore rate! We strongly believe in encouraging all our users to learn more about WordPress. So go ahead and make your changes, we’ve got your back! 

Primary Cause 3: Conflict in Website URL stored in cookies

There are two website URLs configured in WordPress – the HomeURL (also called Site Address) and the SiteURL (also called WordPress address). WordPress banks on these URLs to load your website content. 

If you’ve changed your domain URL or got an SSL certificate, your URL is effectively changed. This can cause login authentication issues if not updated. 

Solution: Ensure both URLs in your WordPress settings are a perfect match

Here’s how to verify this: 

  • Log in to your WordPress Admin Dashboard. Go to Settings and navigate to the General section.

In this section, you can see the two URLs: WordPress Address and Site Address.

WordPress Address URL and Site Address URL in WordPress Settings

  • Go ahead and update these URLs so that they match.

If you’re not able to log in to the WordPress Admin Dashboard at all, not worry!

You can modify the URLs from the wp-config.php file. We explain how to do this in this article: How To Change WordPress Site URL.

Pro-Tip: Making changes to your wp-config.php file is risky business so make sure you stay backed up with BlogVault. You can stay extra safe by using our in-built staging environments to test out your changes. That way your live site is totally unaffected!

Secondary Cause 1: Your WordPress Session Timed Out 

By default, a WordPress login session is set to timeout in 48 hours. While this will not cause you to get logged out repeatedly, you might prefer to extend the duration of your login session.

You can do this by creating a child theme and making code modifications to the functions.php file.

Be warned, creating a child theme is an advanced function to execute. There are multiple things that can go wrong. Not just that, increasing the duration of the timeout session is a security concern if you have multiple WordPress users. 

Recommended Measures Before Creating a Child Theme:

  • Take a complete site backup 
  • Consult someone who is WordPress tech-savvy 
  • Be aware of how to troubleshoot, should things go wrong

To create a child theme, follow the steps in this article: How to Create and Customise a Child Theme.

Once you’ve created the child theme, you have to modify your functions.php file. 

Here’s what you have to do.

Modifying your functions.php file to extend WordPress Session Duration

  • Log in to the WordPress Admin Dashboard.
  • Hover over the Appearance section and from the drop-down box that appears, click on Theme Editor. This will take you to the code of the theme.

Theme Editor in Appearance Menu

  • Locate and open the functions.php file. You can find it on the top of the Theme Files section listed on the right hand side.

Locating the functions.php file in Theme Files

  • Scroll to the bottom of the code and add the following lines:

add_filter( ‘auth_cookie_expiration’, ‘keep_me_logged_in_for_1_week’ );
function keep_me_logged_in_for_1_week( $expirein ) {
return WEEK_IN_SECONDS; // 1 week in seconds
}

  • Now click on Update File to save your changes. 

Your WordPress Login Session duration is now extended to 1 week!

Similarly, you can modify the code to extend it for 1 year or 1 month. Simply replace the word “Week” with “Year/Month” in the respective capitalization. 

If All Else Fails – Restore A Backup Version!

If you have tried all these methods and still aren’t able to log in to your WordPress Admin Dashboard, it is best that you restore your site from a backup.

If you have host backups enabled, you can find a restore option from the host dashboard.

Bluehost Dashboard

You can also manually restore a saved backup. However, if you are not tech-savvy with WordPress and troubleshooting, it is best to stay away from a manual restore.

The best option to backup and restore your site is by using a reliable WordPress Backup Plugin.

But not all backup plugins have an easy restore process.  

If you have backed up your website with BlogVault though, it’s as easy as one-click! Your site will be restored in a matter of minutes!

Here are the steps involved.

How To Restore a Backup Using BlogVault

  • Login to your BlogVault account and choose your website from the Site Listing Page. This will take you to the Site Details Page.
  • Navigate to the Backup section and click on Restore. This will take your to the Restore Page.

Restore Button in Backup Section on BlogVault

  • Now you will need to add your FTP credentials, host/server name, your username and password. If you are not aware of your FTP credentials, refer our guide on How to Find Your FTP credentials

Add FTP credentials for Restore

  • Once you’ve added these details, BlogVault verifies them and asks you to choose the folder where your WordPress Installation is. Use your site name to find this and select it.

Select Folder with WP Installation

  • Now select the backup version that you want to restore. 

Choose Backup Version for Restore

  • Click on Continue.

Restore in Process

  • The restore process begins and can take 2-3 minutes. You can also exit the page if you’d like, the restore will continue in the background! BlogVault will notify you once the restore is complete. 


You should then be able to log in to your WordPress Admin Dashboard easily. 

Pro-tip: Clear the cache after you’ve restored the site so you don’t see any outdated content.

Over To You 

It can be quite stressful to keep getting logged out of WordPress. But the important thing is to not panic! All you need to do is a bit of troubleshooting to find and fix the issue.

Keep a calm mind and test out all these methods one-by-one to find the culprit. Let us know which one worked for you. 

Remember, making any major changes to your WordPress site, especially code changes, is risky and can break your site. 

This is why it’s important to always keep your site backed up. If things go south, you should be able to restore your site quickly. The longer your site stays down, the more your traffic, sales and SEO losses are. 

Secondly, you should always use a staging environment to test changes or troubleshoot errors. This ensures that your live site stays unaffected. 

While there are many solutions available, it’s important to choose a reliable and trusted WordPress Backup and Staging Plugin like BlogVault.

It will automatically run backups for you which can be restored easily. Plus, staging is as easy as one click!

Try BlogVault’s Backups Now.

WordPress keeps logging me out
Share via
Copy link