Are you facing this frustrating problem where WordPress keeps logging you out? Don’t worry, we have an easy fix for you here in this article.
Why WordPress Keeps Logging Out?
WordPress sets a cookie in your browser to authenticate a login session. This cookie is set for the WP URL stored in your settings section. If you are accessing from a URL that does not match the one in your WP settings, then WP will not be able to authenticate your session.
As you can see above in the screenshot, WordPress Address and Site Address doesn’t match. (One missing with “www”)
Fix for this Issue
Login to your WordPress dashboard and go to Settings » General.
If your access is restricted to the admin area, then you can update these URLs by editing the wp-config.php file.
Connect to your website using an FTP client, and locate the wp-config.php file in your site’s root directory. Download this file to your Desktop and open it in a text editor like Notepad. Simply add these two lines of code in your wp-config.php file
If you prefer to use www in URL, then use this code instead
Don’t forget to replace example.com with your own domain name.