In this tutorial, I will be sharing with you how to fix a WordPress keeps logging out problem. Now as you work with WordPress and you are creating blog posts, and you are working with all the codes; maybe you are working on media and WordPress keeps you logged out. This can get very frustrating.
As one of those things that you may have already tried to troubleshoot things like making sure your plugins are updated, maybe with deactivated plugins, maybe you have updated a theme, and you are still having the same issue.
Causes of WordPress Logging You Out
So let’s look at the reason why. So typically, when WordPress log you out there is a good chance because WordPress places a cookie in your browser to authenticate a login session; something is mismatched.
This can cause WordPress not to be able to authenticate your session which in turn results in logging you out constantly. So let’s go and look at these settings.
If you can access your admin panel via your dashboard, simply go to your setting and then go to general and now let’s look at your WordPress address and your site address.
As you look at both of them, of course, your website will be different. Please make note, if they are showing a www version or none www version.
For example, if you have your website at www.yourwebsite.com and then your site address does not have a www version. This is usually the reason why you are getting logged out all the time. So this is a very simple fix. You just need to make sure they both match.
Now again, one note here is that if your site address is different than your WordPress address in terms of if you have a landing page for your website but if you have a blog using WordPress as your blog, of course, those might be a little different so you might have yourwebsite.com/blog, and your site address.
Of course, it would be just youwebsite.com but what we are focused on here is whether or not is the same www version or non www version. So to simply fix this again just make sure that they are both the same and you should be good. But what if for example you cannot login to your admin area, and you cannot access your dashboard? No worries, let’s look at this using FTP.
Now I am using Filezilla, but you might have FTP software that you prefer better. Simply, what we are looking for is we are accessing our web server, and we are looking for the file wp-config.php.
Once you have located this file; simply download it to your computer or view it live. Either way, you would want to use a text editor like Notepad to add a line of code to this file.
Once you have this file open whether or not on your computer or you are viewing it live, simply go all the way to the very bottom and kind of work your way up.
You might have a couple line of code, or it could be the very last code that you will see something that says “That’s all, stop editing! Happy blogging.” We are going to add a couple lines of code right above this.
So what we are adding here is we are defining where our website is pointing to. So what we are adding here is the same thing you might see on your admin panel, but we just cannot access that.
So we are simply going to override the settings manually via the wp-config.php file. So what we are doing here is we are doing the same thing. We are adding the none or www version of our website so they both match.
So again, if you are using www make sure they both show that. If you are using none www make sure again that they do not have that. If they are mismatched, this is what can really cause this issue.
So once you have your settings set, now go ahead and save it and now re-upload it if you downloaded the file or simply save it and refresh your web server via FTP and now everything should be fine.
So basically the reason why this works is that if one is showing www and the other one does not; this is actually making it seem like it is a subdomain and it’s turning it to two different domains or basically two different websites.
So this is what can really log you out and cause the issue but this way, by making them both the same, then when you are refreshing your website; you know it is the same website and there is not two of them; this way you can authenticate yourself and no longer have this issue.