brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wp user session destroy --all logs one account out everywhere

Security
~/tips/tip-wordpress-user-session-destroy

wp user session destroy admin --all

Ends every login session of one WordPress account so old logins stop working.

A forgotten login on a shared computer, or a password you suspect leaked: changing the password is only half of it. The old login sessions can still be valid. wp user session destroy ends them.

wp user session destroy admin --all

The user can be an ID, an email address or a login name. With --all every session of that account is destroyed and the output says Success: Destroyed all sessions. Without it, the command removes only the most recent session, or one specific session if you pass its token after the username.

To see what an account has open first:

wp user session list admin

For the whole site the handbook gives this one-liner, which logs out every user:

wp user list --field=ID | xargs -n 1 wp user session destroy --all

Run that when you suspect a break-in. Everybody, you included, has to log in again, so do not run it in the middle of someone else’s work. If you distrust the account itself, also reset the password with wp user reset-password, and consider wp config shuffle-salts, which invalidates all cookies at once.

Sessions that are already destroyed cannot be undone, but nothing is deleted besides the session tokens.

Further reading: wp user session destroy (WP-CLI handbook)

More Security tips tcpdump -nn -r capture.pcap port 53 mkcert -install Strict-Transport-Security: max-age=0 Referrer-Policy: strict-origin-when-cross-origin wp super-admin list All Security tips (79) All topics

Link