Docs

Session security: idle timeout and force logout

4 min readUpdated November 19, 2026

Session security gives you two controls for logged-in users. The idle timeout logs people out after a period of inactivity. Force logout ends every session on the site at once.

Where to find it

Go to Settings → Login Shield → General tab, then scroll to the Session security section. It sits after “Login notifications” and before “Weekly digest”.

A session security settings panel. It contains an input field for an idle session timeout in minutes and a button labeled “Force logout everyone” that triggers an immediate logout of all active users.

Idle session timeout

The idle timeout logs a user out when they haven’t done anything for a set number of minutes. It’s off by default.

  1. Enter a number of minutes in Idle session timeout. The field accepts 0 to 1440 (24 hours).
  2. Leave it at 0 to keep the timeout off.
  3. Click Save general settings at the bottom of the tab.

Recommended values are 30 to 60 minutes for administrator accounts.

How it works

  • Each logged-in user has a “last active” timestamp. Shield checks it on page requests, on the front end and in the dashboard.
  • If the gap since the last activity is longer than your limit, Shield logs the user out and sends them to the login page.
  • Shield refreshes the timestamp at most once a minute, so it doesn’t write to your database on every request.
  • A small script runs on every page for logged-in users. It watches for mouse movement, key presses, clicks, scrolling and touch, and pings the server once a minute until the idle limit is reached. This keeps someone on a long page, such as an editor, from being logged out while they work.

The warning prompt

Two minutes before the limit, the user sees a browser pop-up: “Your session is about to expire due to inactivity. Click OK to stay logged in.” Clicking OK resets the timer. If the timeout is 1 or 2 minutes, the prompt appears after 1 minute of inactivity.

What happens when time runs out

The user is logged out the next time their browser loads a page or sends a request. A tab left open doesn’t change by itself. They see the login page when they next click or reload.

Because the open tab keeps pinging until the limit is reached, a user who walks away from an open tab is in practice logged out after roughly twice the limit. If no tab is open, the limit applies as set.

Good to know

  • It applies to all roles. You can’t set a different limit per role. That includes customers on a WooCommerce site.
  • The timer is per user, not per device. Activity on one device keeps that user’s other devices from timing out.
  • It ends the session of the device that triggered the check. It doesn’t end the user’s other sessions.
  • When you first turn it on, nobody is logged out straight away. Each user’s timer starts on their next page load.
  • Background browser tabs can slow the script’s timer, so the warning may appear late. The server-side check still applies.
  • The Whitelisted IPs box and NAHNLS_BYPASS_IP don’t affect the idle timeout.

Force logout everyone

Use this during a security incident, for example if you see a login you don’t recognise.

  1. On the General tab, find Force logout all sessions in the Session security section.
  2. Click ! Force logout everyone.
  3. Confirm the pop-up: “This will immediately log out every user on the site including yourself. Continue?”

What it does

  • Ends every active session for every user, on every device, including yours.
  • Clears everyone’s idle timers.
  • Writes an entry to the Log tab, “Force-logged out all sessions”, under your username and IP.
  • Sends you to the login page. Sign back in to continue.

Only users with the manage_options capability (administrators) can run it.

What it doesn’t do

  • It doesn’t change anyone’s password. If an account may be compromised, also reset that password.
  • It doesn’t remove passkeys, authenticator apps or application passwords. Review those on the user’s profile.
  • It doesn’t stop someone logging in again straight away.
  • If you suspect cookies were stolen, changing the security keys (salts) in wp-config.php also invalidates all login cookies.

An incident checklist

  1. At the bottom of the General tab, review Recent successful logins. It shows the last 10 logins that passed all checks.
  2. Click ! Force logout everyone and sign back in.
  3. Reset passwords for any account you don’t trust.
  4. Review the Users list and remove any administrators you don’t recognise.
  5. Check that 2FA is required for administrators.

Troubleshooting

  • Users are logged out too fast. Raise the number of minutes, or set it to 0.
  • Nothing happens after the time passes. The check runs on the next request. Reload the page, and confirm the value was saved and isn’t 0.
  • A page-caching plugin is in use. Cached front-end pages don’t run the server check, but the next uncached request does. Keep logged-in pages out of the cache (see “Caching and login pages”).
  • I forced a logout and I’m locked out. Force logout only ends sessions. Your password and 2FA still work. See “I locked myself out” if you’ve lost 2FA access.

Was this helpful?

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only