Are you trying to stop WordPress from logging you out all the time?
This is a common WordPress error that makes it nearly impossible to work on your website.
In this article, we will show you how to fix the WordPress keeps logging out problem, also known as the WordPress session timeout issue.
Why Does WordPress Keep Logging Out?
There are a few main reasons WordPress keeps logging you out. But most commonly, you are trying to access your site from a URL that doesn’t match the one in your WordPress settings.
When you log in to your WordPress website, it will set a cookie in your browser to authenticate the login session. The cookie is set for the WordPress URL stored in your settings menu.
If the site URL and the WordPress URL don’t match, then WordPress won’t be able to authenticate the session, and you will get logged out.
This can also result in the too many redirects issue in WordPress.
In the image below, the ‘WordPress Address’ and ‘Site Address’ are different, so there will be a conflict.
With that said, let’s show you how to easily fix the WordPress keeps logging out problem.
How to Fix WordPress Keeps Logging Out Issue
The simplest fix for this login issue is to ensure you have the same URL in the ‘Site Address’ and ‘WordPress Address’ fields.
To do this, navigate to Settings » General in your WordPress admin panel.
Then, double-check that the URLs match. You need to choose either a ‘www’ or a ‘non-www’ URL in both fields.
Technically speaking, ‘www’ is a subdomain itself. This means that URLs with ‘www’ and without it are actually two different domain names.
Luckily, changing and updating the URLs to the same address will fix the issue. Then, just make sure to click the ‘Save Changes’ button.
Fixing WordPress Keeps Logging Out Problem by Adding Code to WordPress
If you can’t access your WordPress dashboard, then you will need to edit your wp-config.php file manually. This is a special file that contains important WordPress settings for your website.
For more details on using FTP, please see our beginner’s guide on how to use FTP to upload files to WordPress.
Then, locate the wp-config.php file in your site’s root directory.
You can download the file to your desktop and open it in your preferred text editor, like Notepad.
After that, add the following code above the line that says, ‘That’s all, stop editing! Happy publishing’.
If you want to use ‘www’ in the URL, then you can use the following code instead.
Make sure to replace the ‘example.com’ URL with your own WordPress blog URL.
Then, you need to save the file and upload it back to your root directory. WordPress should now stop logging you out when you log in to your website.
If you are still experiencing the same logout issue, then see our guide on how to fix WordPress login page refreshing and redirecting issue.
We hope this article helped you learn how to fix WordPress keeps logging out problem. You may also want to see our guide on how to create a free business email address and our expert picks for the best domain name registrars.