WordPress Keeps Logging Me Out
You’re writing a blog post, uploading media, or tweaking your theme settings. Suddenly, without warning, WordPress logs you out and sends you back to the login screen. You log in again… only to be logged out a few minutes later.
This WordPress logout loop is more than an annoyance. It can make your site unmanageable, especially if you can’t stay logged in long enough to make updates.
The problem is almost always related to cookies, session handling, or misconfigured URLs. The good news? It’s fixable in a few simple steps. This guide will walk you through all causes, beginner-friendly fixes, advanced troubleshooting, and prevention tips.
Causes of WordPress Logging You Out
- Browser cookies blocked or corrupted – WordPress authentication relies on cookies.
- WordPress URL vs Site URL mismatch – If URLs don’t match exactly, logins won’t stick.
- Plugin conflicts – Security or caching plugins may interfere with sessions.
- Incorrect cookie settings – Misconfigured COOKIE_DOMAIN in wp-config.php.
- Hosting/PHP session issues – Expired or misconfigured sessions in server.
👉 Related: WordPress Keeps Refreshing Login Page
Fixes
1. Clear Browser Cookies & Cache
Corrupted cookies are the #1 reason for logout loops.
Steps:
- In Chrome: Go to Settings → Privacy & Security → Clear Browsing Data.
- Clear cookies and cache for at least the last 7 days.
- Restart browser.
- Try logging in again.
Pro Tip: Test in Incognito/Private Mode to confirm if the issue is cookie-related.
2. Check WordPress & Site URL Settings
If your WordPress Address (URL) and Site Address (URL) don’t match, WordPress won’t set cookies correctly.
Steps:
- Open wp-config.php.
- Add or confirm the following lines:
define(‘WP_HOME’, ‘https://yoursite.com’);
define(‘WP_SITEURL’, ‘https://yoursite.com’);
- Save and refresh your site.
👉 Related: WordPress Too Many Redirects Fix
3. Disable Security Plugins Temporarily
Sometimes security plugins like Wordfence, iThemes Security, or Sucuri can block login cookies.
Steps:
- Access /wp-content/plugins/ via FTP/File Manager.
- Rename the security plugin folder (e.g., wordfence → wordfence_off).
- Log in again.
- If issue resolves, adjust plugin settings or switch plugins.
4. Regenerate WordPress Security Keys
Security keys (salts) manage session encryption. If they’re outdated, they may cause logouts.
Steps:
- Open wp-config.php.
- Find the section with AUTH_KEY, SECURE_AUTH_KEY, etc.
- Replace with fresh keys from the WordPress Salt Generator.
Example:
define(‘AUTH_KEY’, ‘new random key here’);
define(‘SECURE_AUTH_KEY’, ‘new random key here’);
define(‘LOGGED_IN_KEY’, ‘new random key here’);
define(‘NONCE_KEY’, ‘new random key here’);
- Save changes and re-login.
5. Correct COOKIE_DOMAIN Setting
In some cases, an incorrect cookie domain prevents logins from persisting.
Steps:
- Open wp-config.php.
- Add:
define(‘COOKIE_DOMAIN’, $_SERVER[‘HTTP_HOST’]);
- Save file.
6. Check Hosting PHP Session Settings
Your host’s PHP configuration may cause expired or broken sessions.
Steps:
- In cPanel/hPanel, search for PHP Options.
- Ensure session.auto_start = Off.
- Increase session.gc_maxlifetime to at least 3600 (1 hour).
- Save changes.
7. Disable Browser Extensions
Sometimes ad blockers or cookie managers interfere with WordPress sessions. Try disabling them temporarily.
Advanced Troubleshooting
Inspect Cookies in Browser Dev Tools
- Right-click → Inspect → Application → Cookies.
- Check for wordpress_logged_in and wordpress_sec cookies.
- Ensure they are being set and not blocked.
Review Server Logs
- Check error_log in hosting panel for session-related errors.
- On VPS: /var/log/apache2/error.log or /var/log/nginx/error.log.
Test a Fresh User Account
Create a new WordPress admin user from hosting panel (via phpMyAdmin). If the new account works, the issue may be tied to your usermeta table.
SQL example in phpMyAdmin:
INSERT INTO wp_users (user_login, user_pass, user_email, user_registered, user_status, display_name)
VALUES (‘newadmin’, MD5(‘password123’), ‘admin@example.com’, NOW(), 0, ‘New Admin’);
Then assign administrator role in wp_usermeta.
Prevention Tips
- Always keep WordPress core, plugins, and themes updated.
- Use HTTPS consistently (mixing HTTP/HTTPS causes cookie mismatches).
- Limit the number of security/caching plugins.
- Configure your hosting session storage properly.
- Encourage users to allow cookies for your domain.
Conclusion
If WordPress keeps logging you out, the problem usually comes down to cookies or URL mismatches. By clearing cookies, correcting wp-config.php settings, regenerating salts, and reviewing session settings, you can solve the issue quickly.
For ongoing prevention, stick to HTTPS, maintain clean plugin usage, and check hosting session configurations regularly.

