There are lots of WordPress users that keep having this issue with being logged out. Even with deactivating plugins, changing themes, clearing all the browser data did not help. And you know what, even using a WordPress backup did not solve the problem. So, here is what we recommend you to do when you WordPress keeps logging you out of the Dashboard.
Why is this happening
Let’s start with the why. Most systems (including WordPress) set a cookie in your browser settings with the login session details. These cookie things are domain specific, so this might be the problem source for you. What happens is that if you have the wrong settings for the website, cookies are stored in a wrong way. Here is an example:
If you are accessing from a URL that does not match the one in your WordPress settings, then WordPress will not be able to authenticate your session. So, as you can see from the screenshot there is a URL mismatch.
How to fix this
The easy way to fix this login issue is to make sure that you have the same URL in your Site Address and WordPress Address fields in your WordPress settings. Of course, you will have to choose if you want your website with www or without it. So, login to your WordPress dashboard and go to Settings » General tab.
Make sure that you use the exact same domain and URL for both of these inputs, or this solution might not entirely work.
If you would like to hardcode these things directly from code, there is an option for that as well:
That should do it! If you keep having this issue, and this does not work for you or you have a better solution, please write us in the comment area.