Family Encyclopedia >> Electronics

How to Fix WordPress Auto-Logout Issue: Expert Step-by-Step Guide

As WordPress specialists with over a decade of hands-on experience helping site owners, we've resolved countless frustrating auto-logout problems. One recent case involved a user who tried disabling plugins, clearing caches and cookies, and even restoring backups—none of which worked. If you're dealing with WordPress repeatedly logging you out (often called a session timeout), this proven fix will get you back in control.

Why WordPress Keeps Logging You Out

To fix this, first understand the login process. WordPress sets authentication cookies based on the URL in your site settings. Accessing your site via a mismatched URL—like one with 'www' and one without—prevents session validation.

How to Fix WordPress Auto-Logout Issue: Expert Step-by-Step Guide

In the settings screenshot above, notice the mismatch: one URL includes 'www', the other doesn't.

Video Walkthrough

Subscribe to WPBeginner for visual guides. Prefer reading? Continue below.

How to Fix the Auto-Logout Issue

The simplest solution: Ensure both 'WordPress Address (URL)' and 'Site Address (URL)' match exactly—choose either www or non-www consistently.

Log into your dashboard and navigate to Settings » General.

How to Fix WordPress Auto-Logout Issue: Expert Step-by-Step Guide

If you can't access the admin area, edit wp-config.php via FTP. Download the file from your site's root directory, open in a text editor like Notepad, and add this code just above the line reading That's all, stop editing! Happy publishing.:

define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');

For www versions, use:

define('WP_HOME','https://www.example.com');
define('WP_SITEURL','https://www.example.com');

Replace 'example.com' with your domain. Upload the updated file.

Why This Works

Technically, 'www' is a subdomain, making www.example.com and example.com distinct. Matching URLs resolves authentication mismatches. For deeper insight on www vs. non-www, see our detailed guide.

Incorrect settings here can also cause redirect loops. This fix prevents both.

We hope this resolves your WordPress session timeout. If issues persist, check our guide to fixing WordPress login refresh and redirect problems.

Liked this? Subscribe to our YouTube channel for more tutorials, and follow us on Twitter and Google+.