WordPress Keeps Logging You Out: Why Sessions End
Wordpress keeps logging out: session ends mid-article? Here is why WordPress logs you out unexpectedly and how to test each cause instead of guessing.
When wordpress keeps logging out, the session cookie is being rejected or dropped.
You are writing an article, saving a draft, then switching tabs to check a reference. Coming back to the editor, the login screen is waiting. After signing in again, the same thing happens: the session ends before the work is done.
Sudden logouts differ from being unable to log in to WordPress admin. Here the credentials are correct and sign-in succeeds; the session simply does not survive. The cause is not a wrong password but the mechanism linking your browser to your account: cookies, server sessions, cache, and the site address.
Short answer: check four things in order—site address and HTTPS, cookie settings, cache, then host session settings. If logouts happen on one device only, the problem is in the browser; if they happen everywhere, it is in the server or configuration.
How WordPress remembers your login
When you sign in successfully, WordPress sends a cookie containing a session marker and an authentication token. That cookie is tied to a specific domain and path, and is only sent back when a request matches.
If anything changes one of those three—domain, path, or HTTPS status—the browser stops sending the cookie, and WordPress treats you as signed out. There is no error message; the admin page simply becomes a login page.
Understanding this mechanism makes symptoms easier to read: a sudden logout is not an authentication failure, it is a failure to preserve proof of authentication.
Wordpress keeps logging out: Site address and HTTPS must be consistent
The most common cause is a mismatched address. If siteurl says https://domain.com but you visit https://www.domain.com, a cookie written for one host is not sent to the other. Every switch looks like a logout.
Check:
- Can the site be reached with and without
www? Pick one canonical address and redirect the other permanently. - Do
siteurlandhomeuse the same protocol you use? A site still naminghttp://in one value produces inconsistent cookies. - Do any pages load over HTTP? Mixed assets—as covered in mixed content after SSL—can trigger odd behaviour, including sessions that will not stick.
After standardising the address, sign out, clear the site’s cookies in your browser, and sign in again. Address changes rarely take effect while old cookies remain.
Cookie settings in wp-config.php
WordPress allows customising cookie domain and path. A wrong value here produces constant logouts, and these settings are often left over from an incomplete migration.
What to review:
COOKIE_DOMAIN—if it names the wrong domain, cookies are sent where they are not used.SITECOOKIEPATHandADMIN_COOKIE_PATH—if the path does not match the install location, cookies do not apply in admin.COOKIEHASH—usually automatic, but could misbehave when hardcoded.
If the site moved from a subdirectory to the main domain (or the reverse), these values often still point at the old location. Removing lines you do not need is usually safer than keeping them without a clear reason.
Cache serving the login page
Page cache should never store admin pages, but an over-aggressive configuration can do exactly that—especially when exclusions for /wp-admin and wp-login.php are missing.
The pattern is distinctive: you sign in, then every click bounces back to the login page. In other cases the admin renders but buttons do nothing because nonces come from an old cached version.
Confirm these:
/wp-admin/is not cached by a plugin, CDN, or proxy.wp-login.phpis not cached.- Pages with user cookies are not shared between visitors.
- Object cache does not store sessions with a shorter lifetime than the cookie.
After changing exclusions, purge all caches and test again. A CDN needs separate checking because it has its own rules.
Wordpress keeps logging out: Security plugins and session restrictions
Security plugins often add rules that cut sessions:
- An inactivity timeout that is too short, say fifteen minutes.
- One session per account, so signing in elsewhere forces the first device out.
- IP-based restrictions, which break sessions when the address changes—common on mobile connections.
- User-agent checks that treat small changes as a threat.
- Forced logout after settings changes, which can repeat when something conflicts.
If logouts happen whenever you switch networks or open a second device, a security plugin is the prime suspect. Disable it temporarily in staging or during a quiet window to confirm, then adjust its settings instead of switching it off permanently.
Hosting, load balancers, and sessions
On hosting with multiple servers, requests may be handled by different machines. If sessions live in local files on each machine, a login on one is unknown to the other—producing random logouts that are hard to explain.
Signs pointing here:
- Logouts occur irregularly, unrelated to time or activity.
- Problems began after the host added capacity or moved the site.
- Admin is sometimes fast, sometimes asks for a login again with no pattern.
The fix lives at the hosting layer: sessions must be stored somewhere shared, such as Redis or centralised storage, and the configuration must apply on every machine. This is not something you can repair from inside WordPress, so a ticket to the provider is the right move.
PHP settings that affect sessions
Several PHP values affect how long sessions last:
session.gc_maxlifetimesets how long session data survives before cleanup.session.cookie_lifetimedecides whether the cookie outlives a browser close.session.save_pathmust be writable and not cleared too aggressively.
A short gc_maxlifetime can drop sessions even while you are active. Hosts with tight limits sometimes set low values to save resources.
To check, open Tools → Site Health → Info → Server and compare against the complaint. If sessions end after a specific number of minutes, the value likely matches that duration.
Testing the right way
To avoid guesswork, run controlled tests:
- Use incognito so old cookies and cache do not interfere.
- Sign in and leave one tab idle for several minutes.
- Open a second tab to another admin page and see whether the session holds.
- Test from a different network to see whether IP matters.
- Test from another device to separate browser issues from server issues.
If logouts happen in one browser only, clear cookies and review extensions. If they happen everywhere, point the investigation at the server, cache, and security plugins.
Habits that reduce the disruption
A few simple habits lower the frequency:
Wordpress keeps logging out when the site address and the cookie domain disagree with each other.
- Sign out properly before closing the browser, so cookies are not left in a half-valid state.
- Do not share admin accounts; overlapping sessions log each other out in turn.
- Use a password manager instead of jotting passwords down, to avoid unnecessary repeated logins.
- Avoid many editor tabs on the same article, since autosave can overwrite and force re-saves.
- Keep the browser updated, because modern cookie behaviour changes.
On sites with several authors, the “one account, one person” rule matters for session stability as much as for security.
Impact on editorial work
Frequent logouts are more than annoying; they cause lost work. Unsaved drafts disappear, settings changes never apply, and writers start saving compulsively or copying text elsewhere as insurance.
If the problem persists, consider drafting in an offline editor or saving far more often until the cause is found. It is not a permanent solution, but it lowers the risk of losing content while diagnosis continues.
Wordpress keeps logging out: what matters first
Sudden logouts are almost always about cookies or sessions, not passwords: cookie domain, HTTPS, cache, or servers that do not share sessions. Test in incognito with a single tab. If the problem disappears, the cause is browser cache or cookies, not WordPress. Many answers appear once wp-config.php is read, not while guessing.
Frequently asked questions
Why am I logged out every few minutes? Likely a short session setting, a strict security plugin, or cache serving a stale login page. Check all three in order.
Does clearing cookies fix it? Sometimes, if the stored cookie is corrupt. If the cause is the server or cache, the problem returns.
Does a logout mean my account was hacked? Not necessarily. But if it comes with an unexpected password reset email, secure the account immediately.
Does incognito fix the problem? It does not fix it, but it helps establish whether the cause is in the browser or in the server.
If you have standardised the address, reviewed cookies, and cleared cache but sessions still break, the cause is likely in hosting configuration or a security plugin. A free audit can review both at once, while website maintenance includes session tuning as part of routine care. If the site is entirely unreachable, website emergency support is available.
Read next: Site Broken After a PHP Update: Finding the Cause, WordPress Comments Not Showing: Check in This Order, WordPress Upload Size Limit: Raising It Safely.
Does any of this look like your website?
Tell us on WhatsApp. We look first, explain what needs fixing, then you decide. For a fuller picture, request the free audit.
Related articles.
Site Broken After a PHP Update: Finding the Cause
Wordpress broken after php update: white screen, errors, or dead plugins after raising the PHP version?
WordPress Comments Not Showing: Check in This Order
Wordpress comments not showing: comments missing, stuck in moderation, or invisible to readers?. Panduan praktis yang bisa dipakai hari ini.
WordPress Upload Size Limit: Raising It Safely
Wordpress upload size limit: uploads failing because of size? A practical order for raising upload_max_filesize, post_max_size.