WordPress Keeps Logging Out – How to Fix It?

“WordPress keeps logging out” is a problem faced by many WordPress users.

“WordPress keeps logging out” is a problem faced by many WordPress users. Often, it happens that when you are logged in and using the Dashboard, a popup comes which asks you to login to WordPress to continue whatever you were doing. You have login and resume work.

This is quite problematic when you are involved in serious WordPress work.

Few days back, I encountered the WordPress keeps logging out error. I tried to deactivate – activate the plugins one-by-one, restored the WordPress site from backups, cleared browser cookies and even emptied the browser cache but nothing seemed to work. Ultimately, I found a solution which worked for me and I hope it will work for you too.

The “WordPress keeps logging out” error is also known as the “WordPress session timeout” issue.

Why “WordPress Keeps Logging Out”?

To understand this, you need to understand how the WordPress login functionality works. What WordPress does is authenticate the login session with the cookies stored in the browser. If the login WordPress URL doesn’t match the WordPress settings, your login session will not be authenticated.

By the WordPress URL in Settings, we mean this. Go to Settings > General and you will see two options:

  • WordPress Address URL
  • Site Address URL
Incorrect WP URL Settings

Both the URL needs to be same for the site to function properly. In the screenshot above, you will see that one URL has www while the other does not have the www parameter. This creates login conflict.

How to Fix “WordPress Keeps Logging Out Issue”?

The only way to prevent “WordPress keeps logging out” issue is to prevent URL mismatch from happenings.

If the URL’s on Settings > General page aren’t the same, you need to fix it now. You either need to choose the www or without www version.

Correct WP URL Settings

You can do this change either from the WordPress Dashboard or by editing the wp-config.php file. Connect to the WordPress website using an FTP client and locate the wp-config.php file in root directory.  Download the file and open it using a text editor like Notepad.

Here you need to make either of these two code additions. Locate the line which says: That’s all, stop editing! Happy blogging.

Add the code given below if you want the site URL to be without www.

define(‘WP_HOME’,’https://example.com’);

define(‘WP_SITEURL’,’https://example.com’);

If you want the site URL to be with www, add the below code:

define(‘WP_HOME’,’https://www.example.com’);

define(‘WP_SITEURL’,’https://www.example.com’);

Replace example.com with the site domain name.

Why You Need to Fix This Issue?

WordPress Keeps Logging Out

You may think of ignoring the “WordPress keeps logging out” issue but not fixing this will lead to other site errors. The first thing that will happen is there are going to be too many redirect issues. It means every post or page on the site will have a www and without www version.

This happens because the domain with www and without www is treated as two different entities, that is, as two different domains.

Therefore, you need to fix the “WordPress keeps logging out” issue ASAP.

Login Page Refreshing and Redirecting Automatically

Sometimes, it also happens that when you want to login to WordPress, the login age just refreshes and redirects to the same page. No login credentials work. You are practically booted out of your own website. Moreover, if there are registered users on your website, they will face the same problem while logging it.

In the “WordPress keeps logging out” issue, we saw that you are logged out after you login to the site but here, you are unable to login completely.

You can solve it using the following methods.

1 – Clear Website Cookie

Cookies are used for login authentication so the first troubleshooting step is to clear the browser cookie and cache. Close the browser. Open the browser again and try to login. This should solve the problem. If not, keep reading on.

2 – Revert to Default Theme

Sometimes, updating the theme from old to new version can cause conflicts to arise. To solve the login problem, you need to deactivate the current them and revert to WordPress default theme.

To do this, login to the website using FTP panel and go to the /wp-content/themes/directory and rename the current theme to anything else. Detecting the change in current theme name, WordPress will automatically switch to the default theme. Try logging in after this step. If you can login, it means the current theme was creating the problem.

What if you are already using the default theme as the current theme? The same process follows. Rename the default current theme and login. If you are successful, it means the default WordPress theme became corrupt. You have to download the fresh version from WordPress theme repository and upload to it to the website.

3 – Deactivate Plugins

Like themes, conflict between two or more plugins can sometimes cause the login error. Login to the website using FTP client and access /wp-content/plugins/directory and rename the plugins file to plugins_backup. This will automatically deactivate all themes and now you can try login to WordPress admin. If it works, it means there was conflict between plugins.

Once logged it, update all the plugins (if available) and activate plugins one-by-one. If activating any of the plugins causes you to log out, it means the plugin is corrupt and needs to be removed. Use FTP client to login and remove the plugin completely.

4 – Update Site URL

Follow the process highlighted to solve the “WordPress keeps logging out” error and update the site URL’s. This should work.

5 – Check .htaccess File

Sometimes the .htaccess file become corrupt, leading to login page refreshing error or problems in connecting with the internal server. Access the .htaccess file by logging in to website through FTP client and download it on your system as a backup. Now delete the .htaccess file from the root directory and the wp-admin directory.

Try to log in. If it works, it means that the .htaccess file was stopping you from logging it. Once you are logging to WordPress Dashboard, click on Settings > Permalinks and click Save. This action will create a new .htaccess fie and the error won’t happen.

Any of these five solutions will take care of WordPress login error or from the refresh page from automatically recurring.

Endnote

We hope that apart from learning to solve the “WordPress keeps logging out” error, you also learned about other WordPress errors and ways to solve them. Doubts or questions or feedback can be shared below.

Share this post

Other Posts

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

wordpress ping list updated 2019. Hey Blogger Outliners….! You want to index your blog post as soon as you edit or modify a post …
Scroll to Top