If you’re experiencing the “WordPress keeps logging me out” error message frequently, you’ve come to the right place.
Typically, this issue occurs because of a problem with the cookie that WordPress tries to set to authenticate a login session. It could also be an issue with some WordPress URL settings that are mismatched.
Regardless of the cause, here’s how to troubleshoot and fix the WordPress session timeout problem.
1. Clear Your Browser’s Cache
The “WordPress keeps logging me out” issue could originate from your browser. The page may be cached in your browser and could be trying to authenticate the session through an expired cookie.
Clearing your browser’s cache will fix the issue if this is the case. For details, check out How to Clear Your Cache for All Major Browsers.
2. Clear Your Browser’s Cookies
Similarly, the issue could be with the cookie that’s already saved in your browser for the site. If the cookie has expired but mistakenly overrides your recent login, it can cause the error.
Fortunately, you can clear your browser’s cookies to fix it.
Chrome
Step 1
In Chrome, go to the top, right-hand corner and click the More button. It looks like a hamburger icon: Three vertical lines or dots.
Step 2
Then, in the drop-down menu, select More Tools > Clear Browsing Data.
Step 3
Toward the top of the pop-up, select a time range for how far back data should be cleared. To delete everything, select All time from the drop-down box.
Step 4
Then, check the Cookies and other site data as well as the Cached images and files boxes. Optionally, you can also check the Browsing history option.
Step 5
Click the Clear data button. Depending on how much data needs to be erased, it may take a few minutes to finish the process.
Safari
Step 1
To clear cookies in Safari, open the browser and select Preferences from the menu.
Step 2
Next, click the Privacy tab and then on the Manage Website Data button.
Step 3
Click the Remove all button to delete all cookies from Safari.
Firefox
Step 1
After opening Firefox, click the hamburger settings icon on the top, right-hand corner. Select Preferences from the drop-down menu.
Step 2
A new tab will open with settings. Click on Privacy & Security in the menu on the left. Scroll down to the Cookies and Site Data section and click the Manage Data button.
Step 3
In the pop-up that appears, click the Remove All Shown button to delete the cookies. Then, click on Save Changes.
Edge
Step 1
Open your browser and click the ellipsis at the top, right-hand corner. Then, go to History > Clear Browsing Data.
Step 2
In the Time range drop-down box, make a selection that works for your situation. Think about how long the “WordPress keeps logging me out” issue has been happening. Choose a time frame that’s at least as long.
For example, if you have only experienced the problem for a few minutes, the default Last Hour option should work. Otherwise, you can choose a different range including All Time.
Step 3
Next, be sure the boxes for Cookies and other site data as well as Cached Images and files are checked. You can optionally choose to also select to clear your browsing and download history.
Once that’s done, click the Clear Now button.
3. Check Your Browser’s Settings
If that doesn’t work, the problem could originate from your browser’s cookie settings. If they’re set up to force cookies to expire, they need to be changed.
In this kind of situation, the steps below should do the trick for the type of browser you’re using.
Chrome
Step 1
In Chrome, click the menu icon in the top, right corner and select Settings.
Step 2
A new tab will open with a lot of options. Scroll down to the bottom of the page and select Advanced.
Step 3
A list of additional options will dynamically appear. Click on Site Settings under the Privacy and security section.
Step 4
Under the Permissions section, find the Cookies and site data settings. If it doesn’t have the label Allow site to save and read cookie data underneath and it says Blocked, then click on it.
Otherwise, this isn’t what’s causing the “WordPress keeps logging me out” issue. In this case, you can skip down to the next section for further troubleshooting.
Step 5
Click the toggle button next to the Blocked label under the Cookies and site data section. Once you do that, it should automatically switch and change to allow the saving of cookies.
Safari
Step 1
In Safari’s menu, choose the Preferences option.
Step 2
Go to the Privacy tab. Then, next to the Cookies and website data option, make sure the Block all cookies box isn’t checked. If it’s checked, click it. The change will automatically be saved.
Step 3
Check if the “WordPress keeps logging me out” issue is gone. If it persists, you can check this box again if you don’t want your browser to save cookies.
Then, next to Website tracking, make sure the Prevent cross-site tracking isn’t checked. If it is, click on it.
Firefox
Step 1
Open Firefox and click the gear icon that can be found on the default new tab page. It’s the page with your top sites listed.
The icon is located toward the top, right corner of the page.
Step 2
A new tab will open with settings. Then, go to the Privacy & Security tab in the menu on the left.
Go to the Enhanced Tracking Protection section and select the Standard option.
If this option is already selected, continue troubleshooting.
Edge
Step 1
With your browser open, click the hamburger icon at the top, right and go to Settings.
Step 2
Go to the Site Permissions tab and find the Cookies and site data button. If it has the word “Blocked” underneath it, click on it.
On the other hand, if it says “Allowed,” continue troubleshooting.
Step 3
Click the toggle button next to Allow sites to save and read cookie data. This change is automatically saved.
Step 4
Check if the “WordPress keeps logging me out” issue is fixed. Or if it’s already enabled, make sure the toggle button for Block third-party cookies is disabled.
At this point, if you check to see if the “WordPress keeps logging me out” error is still happening and it’s still an annoying nuisance, click the Add button next to Allow.
Step 5
Enter the address of the site that’s giving you trouble with the “WordPress keeps logging me out” error into the text field. Then, click Add.
4. Clear Your WordPress Site’s Cache
If you have made it this far and the issue persists, your browser isn’t to blame. But, your WordPress site’s cache may be the cause of the “WordPress keeps logging me out” issue.
Don’t worry, though… There are still a few ways to fix it!
You can clear your site’s cache in a few clicks, but the process differs depending on your host as well as if you’re using a caching plugin.
If you’re using a plugin for caching, check its documentation.
Otherwise, check with your host for the directions to clear the cache for your site and server.
If you’re using Kinsta to host your site, clearing your site’s cache is straightforward and you can check out How to Clear WordPress Cache On Your Site for details.
5. Double Check Your WordPress Site Address
Sometimes, WordPress login session cookies aren’t saved because the URL defined in the cookie doesn’t match the site address.
To fix this, check your WordPress settings and make sure the Site Address (URL) and WordPress Address (URL) fields are the same.
Step 1
Log into your site and go to Settings > General in the menu. Then, update the addresses as needed and make sure they’re correct.
Sometimes, it could be that there’s a “www” prefix when there shouldn’t be. Also, check that there’s an “https” prefix if you have an SSL certificate installed on your domain.
If you made any adjustments, click Save Changes at the bottom of the page.
Manually Update WordPress Addresses
If that doesn’t work to resolve the “WordPress keeps logging me out” error, you’ll need to update these addresses manually.
To do this, you need to edit your wp-config.php file.
You can use SFTP for this and the details can be found here: How to Use SFTP to Connect to Your WordPress Site.
Step 1
Once you have established a connection with your site using SFTP, download and open the file. Or, if you’re using FileZilla, you can click on the file, then right-click on it and select View/Edit from the list.
Step 2
Above the “happy blogging” line, enter the code below:
define('WP_HOME','http://your-site.com');
define('WP_SITEURL','http://your-site.com');
Be sure to change “http://your-site.com” to your actual domain. Also, check that your use of “HTTP” or “HTTPS” is correct.
If you have an SSL certificate installed for your site, then you should choose the “HTTPS” prefix.
For details, check out How to Redirect HTTP to HTTPS in WordPress.
In the example above, there’s also no “www.” prefix. If your site includes one and is set up to be used that way in your domain’s DNS settings, then be sure to add it.
Step 3
Save the file and upload it back to your site in the main folder. Or, if you’re using FileZilla, then go back to the client and click Yes when you’re prompted to overwrite the new version of the file to your server.
6. Disable and Re-Enable WordPress Plugins
If you have reached this point without success in resolving the “WordPress keeps logging me out” error, there may be an issue with one of the plugins you’re using.
When a plugin needs to authenticate the session with a cookie, but it’s not set up properly or there’s an issue with the cookie, it can cause the WordPress login timeout error.
To troubleshoot this probable cause, you need to manually disable your plugins. For details, check out How to Disable WordPress Plugins (No Access to WP-Admin).
Step 1
Using SFTP, go to /wp-content/ and rename the plugins folder. Choose a name that’s clear to avoid future confusion.
Step 2
Refresh your site and check if the “WordPress keeps logging me out” issue has been resolved.
If it’s fixed, rename the plugins folder back to its original name. Then, refresh the page in your browser.
Step 3
Go to Plugins > Installed Plugins and activate the plugins one-by-one until the error resurfaces.
Step 4
Now that you know which plugin is causing the “WordPress keeps logging me out” issue, you can delete it.
If you still have access to your site, stay on the Plugins page and click Deactivate under the listed problem plugin. Then, click the Delete link that appears next to the Activate link.
If you don’t have access to your site, you can use SFTP to rename the plugins folder again, then change it back to its original name after that.
Next, refresh your site in your browser and delete the plugin.
Now, you can search for a suitable alternative if you urgently need to use the features the plugin offers. Otherwise, you can contact the plugin’s author to report the issue and request a fix.
7. WordPress Keeps Logging Me Out Nonetheless
If you’re still experiencing the “WordPress keeps logging me out” issue, you can manually extend the time for which a user is remembered when they check the “Remember Me” box.
This is also helpful if the default isn’t long enough or the timing was previously changed and it no longer works for you.
Manually Update How Long You’re Remembered
Step 1
Create a child theme with a functions.php file if you haven’t done this already. You can check out How to Create a Child Theme in WordPress (Extended Guide) for details.
In your child theme’s functions.php file, add this filter:
add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_year' );
function keep_me_logged_in_for_1_year( $expirein ) {
return YEAR_IN_SECONDS; // 1 year in seconds
}
It may be important to note that the above filter will remember a user for one year. If you prefer to change this, here are other possible options which you can use to replace “YEAR_IN_SECONDS”:
- DAY_IN_SECONDS – Users are remembered for only one day.
- WEEK_IN_SECONDS – This means one week.
- MONTH_IN_SECONDS – This is for users to be remembered for one month.
Keep in mind that if you’re developing locally, letting your user account be remembered for one year may not be a huge security threat if your computer is secure and you use an antivirus app. But, it’s not secure for production sites or staging sites.
You also may not want to make the change for users to be remembered for one day since this may cause you to see the “WordPress keeps logging me out” issue all over again.
Consider your options and choose the value that works for you.
Summary
When WordPress keeps logging you out, it’s extremely frustrating.
Fortunately, the WordPress session timeout giving you the “WordPress keeps logging me out” problem can be quickly resolved in most cases. Specifically, make sure to:
-
- Clear Your Browser’s Cache
- Clear Your Browser’s Cookies
- Check Your Browser’s Settings
- Clear Your WordPress Site’s Cache
- Double Check Your WordPress Site Address
- Disable and Re-Enable WordPress Plugins
- Manually Update How Long You’re Remembered
If you host your site with Kinsta and still need help, feel free to reach out to us. We have WordPress experts ready and waiting to help.
Save time, costs and maximize site performance with:
- Instant help from WordPress hosting experts, 24/7.
- Cloudflare Enterprise integration.
- Global audience reach with 34 data centers worldwide.
- Optimization with our built-in Application Performance Monitoring.
All of that and much more, in one plan with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to find the plan that’s right for you.