The error of WordPress keeps logging out is common. Many users face this issue in WordPress. This error is also sometimes known as the issue of WordPress session timeout. As the name itself suggest, this error acts as a hindrance in accessing your WordPress website.
If you are facing any such issue, we are here to help you. All you have to do is to go through the solutions provided in this article.
Causes of WordPress Keeps Logging Out Error in WordPress:
If WordPress keeps logging you out, there could be various causes. One of the common reasons is that there is an URL mismatch. If you will access your WordPress website from a URL that is different from the URL in your WordPress settings, the error WordPress keeps logging out might appear.
A cookie is set in your browser on logging into your WordPress website. This is to ensure the authentication of the login session. The WordPress URL stored in your settings menu is utilised to set the cookie for your login session. On URL mismatch, i.e, when the ‘WordPress Address’ and ‘Site Address’ are different, the authentication of the login session becomes impossible. Because of the conflict, the session will stop and you will be logged out.
In this case, some other error might also appear. One such error is the too many redirects issues in WordPress.
Now that the causes of the error are clear, let us look into the most popular solutions for fixing this error.
Fixing the WordPress Keeps Logging Out Error:
Method 1: Ensure the same URL as ‘Site Address’ and ‘WordPress Address’:
To ensure the same URL as the site and WordPress address, you can follow the below steps:
- Go to your WordPress admin panel.
- Go to Settings » General page.
- Check for the matched URL addresses.
- In both the fields, either choose ‘www’ or a ‘non-www’ URL.
- Since ‘www’ is a subdomain in itself, a ‘www’ or a ‘non-www’ URL represents two different domain names.
- Change and update the URLs to the same address.
- Click on the ‘Save Changes’ button.
- Reconnect to your might. The error might be resolved by now.
- If not, you can also check the next method.
Method 2: Adding Code to WordPress:
This method is recommended if accessing your WordPress admin area is impossible for you. To edit your wp-config.php file containing your important WordPress settings, you can follow the below steps:
- Connect to your WordPress website using an FTP client, or the file manager app in your WordPress hosting account control panel.
- Locate the root directory of your website.
- Locate the wp-config.php file.
- Download the wp-config.php file to your system.
- Open the file using a text editor like Notepad.
- Add the below code for the ‘non-www’ URL, above the line that says, ‘That’s all, stop editing! Happy publishing.’
define(‘WP_HOME’,’https://example.com’);
define(‘WP_SITEURL’,’https://example.com’);
- For URL with www, you can use the below code.
define(‘WP_HOME’,’https://www.example.com’);
define(‘WP_SITEURL’,’https://www.example.com’);
- Here, you will have to replace the ‘example.com’ URL with the URL of your WordPress website.
- Save the file.
- Upload the file back to your root directory.
- Reconnect to your website.
- The issue should be resolved by now.
If you are still facing the issue, you can check our article on fixing the login page refreshing and redirecting issue in WordPress. You can also check our articles on other popular WordPress Errors.