Skip to content
  • Apps
  • Anime
  • Gaming
  • Alternatives
  • Proxy
  • Guides
    • How to
    • Resources
    • Tips
  • Apps
  • Anime
  • Gaming
  • Alternatives
  • Proxy
  • Guides
    • How to
    • Resources
    • Tips

How to Force Logout All Users in WordPress (Simple & Easy)

  • April 24, 2026
  • by Ricky Spears
  • 6 min read

Hey there! Have you ever needed to quickly log out every single user from your WordPress site? Maybe you suspect a hacker has gotten unauthorized access, or you want to ensure users reset their passwords.

Navi.
Understanding WordPress User Authentication
Steps to Force Logout All WordPress Users
More Details on Editing wp-config.php
The Importance of Strong WordPress Passwords
More Tips to Harden WordPress Security
Related

Whatever the reason, having all active sessions ended instantly can be a crucial troubleshooting and security step. But WordPress doesn‘t have a big red "Log Out Everyone" button in the admin dashboard.

Don‘t worry though – with a quick modification to one of WordPress‘s core files, you can invalidate all logged-in user cookies and force everyone to re-authenticate.

In this guide, I‘ll walk you through the simple steps to force logout all users in WordPress. I‘ll also share some important tips to harden your site‘s security and password policies to help prevent unauthorized access in the first place. Let‘s dive in!

Understanding WordPress User Authentication

To understand how force logging out all users works, it‘s helpful to know a bit about how WordPress manages user authentication behind the scenes.

When someone successfully logs into WordPress, the system sets cookies in their browser. These contain an encrypted hash of the username and an "expiration" timestamp. On every subsequent page request, WordPress checks for those authentication cookies and verifies the hashed values match what‘s expected for that user.

As long as the cookies are valid and not expired, WordPress considers that browser session authenticated and grants access to the user‘s roles and permissions.

Normally, a login cookie remains valid until one of the following happens:

  • The user explicitly logs out, which deletes the auth cookies
  • The cookie‘s expiration time is reached (by default, 2 days or 14 days if "Remember Me" was checked)
  • The user‘s password is changed, which invalidates any previous cookies

So to force log out all users, we need a way to make WordPress treat every user‘s auth cookies as invalid. Let‘s look at how to do that.

Steps to Force Logout All WordPress Users

Here‘s the quick and easy way to invalidate all active user sessions on your WordPress site:

  1. Back up your WordPress files, especially wp-config.php
  2. Connect to your WordPress file directory via FTP or hosting file manager
  3. Download a copy of wp-config.php and open it for editing
  4. Find the section defining your authentication keys and salts
  5. Generate new random keys and salts at https://api.wordpress.org/secret-key/1.1/salt/
  6. Replace the existing key definitions in wp-config.php with the newly generated ones
  7. Save your changes and re-upload wp-config.php to your server

By updating the authentication keys and salts in wp-config.php, you instantly make all existing login cookies invalid. Any browser that sends a request to WordPress will fail the cookie hash comparison check and be booted back to the login screen.

More Details on Editing wp-config.php

Since we‘re editing WordPress‘s core configuration file, it‘s important to be careful and make a backup copy first. wp-config.php is a critical file that contains your database login credentials and other key settings. A mistake here can take down your whole site.

When you open wp-config.php, you‘ll see the authentication keys defined like this:

define(‘AUTH_KEY‘,         ‘Y0=Eku2jV-EXAMPLE`w$kU}‘);
define(‘SECURE_AUTH_KEY‘,  ‘$v]JBm+EXAMPLE-eq660Kf‘);
define(‘LOGGED_IN_KEY‘,    ‘LnFkEXAMPLERuc327vm+‘);
define(‘NONCE_KEY‘,        ‘EXAMPLEB3K9EX>d2Ky#kG‘);
define(‘AUTH_SALT‘,        ‘EXAMPLE9|KkM.Hpdvn"N0‘);
define(‘SECURE_AUTH_SALT‘, ‘EXAMPLE@+yXhxLk2T>!7_‘);
define(‘LOGGED_IN_SALT‘,   ‘EXAMPLEc>Yj)wT<]+9|5`‘);
define(‘NONCE_SALT‘,       ‘EXAMPLEl5=Dw}I-3-~zGa‘);

The actual values will be random strings generated when WordPress was first installed. You‘ll want to use the WordPress.org salt generator to create brand new keys:

define(‘AUTH_KEY‘,         ‘zEXAMPLE{rO2uPC-BjqKZ‘);
define(‘SECURE_AUTH_KEY‘,  ‘OEXAMPLE|ZwNUg@`C80GH‘);
define(‘LOGGED_IN_KEY‘,    ‘EXAMPLE06Pi+ZG41_3G_l‘);
define(‘NONCE_KEY‘,        ‘;EXAMPLE#|sWylPPa`)nL‘);
define(‘AUTH_SALT‘,        ‘EXAMPLEt(2MP8+Q@aw$sj‘);
define(‘SECURE_AUTH_SALT‘, ‘(EXAMPLE{Zs/UCqHnF9eQ‘);
define(‘LOGGED_IN_SALT‘,   ‘EXAMPLE/+:{Br?CMs+`~_‘);
define(‘NONCE_SALT‘,       ‘EXAMPLEwp>d6My[A-D)+@‘);

Copy and paste this full block of new definitions into wp-config.php, completely replacing the previous ones. Be sure to maintain the same formatting, with each line beginning with define( and the values wrapped in single quotes.

Once you‘ve saved your changes and uploaded the file back to your server, all existing user sessions will be forcibly ended. You can test it by opening your site in an incognito browser window. If you were previously logged in there, you should now be redirected back to the login form.

The Importance of Strong WordPress Passwords

Needing to force log out all users is often a sign of a hacked site or compromised accounts. Outdated, weak, or reused passwords are one of the most common vulnerabilities that attackers exploit to gain unauthorized access.

Consider these sobering statistics:

  • WordPress sites are the target of 90,978 attacks per minute (per WordPress)
  • The median time for a brute force attack to guess a 12-character password is 62 years (per Hive Systems)
  • 81% of data breaches are due to weak or reused passwords (per TraceSecurity)
  • The top 5 most common passwords are: 123456, 123456789, qwerty, password, 12345 (per NordPass)

If you suspect a breach, it‘s crucial to have all users reset their passwords to something strong and unique. Even if you‘re not forcing logouts due to an attack, it‘s wise to regularly prompt users to change and upgrade their passwords.

Some best practices for WordPress password policies include:

  • Require a minimum length of 12-14 characters
  • Enforce a mix of uppercase, lowercase, numbers, and symbols
  • Check against lists of commonly used or compromised passwords
  • Enable two-factor authentication for an extra layer of verification
  • Automatically expire passwords every 60-90 days

There are several good WordPress plugins available to help implement and enforce these password security rules, such as:

  • Force Strong Passwords
  • Wordfence Login Security
  • iThemes Security
  • Jetpack
  • WP Cerber Security

You can also use web.config or .htaccess rules on your server to set password strength requirements.

More Tips to Harden WordPress Security

Strong passwords are a great start, but there are a number of other security best practices that can help harden your WordPress site against unauthorized access:

  • Keep your WordPress core, plugins, and themes updated to patch known vulnerabilities
  • Delete unused plugins and themes to reduce your attack surface
  • Use the least privileged user roles and limit admin accounts
  • Enable SSL and enforce HTTPS to encrypt data in transit
  • Implement a web application firewall (WAF) to block malicious traffic
  • Disable XML-RPC and restrict REST API access if not needed
  • Enable automatic malware scans and file change detection
  • Limit failed login attempts to prevent brute force attacks
  • Disable the theme and plugin file editor
  • Regularly test your backups and have a disaster recovery plan

Many of these can be implemented with the help of a security plugin or service, such as:

  • Sucuri Security
  • Wordfence
  • iThemes Security Pro
  • Malcare
  • Jetpack Security

By taking a multi-layered approach to securing your site, you can greatly reduce the risk of a compromise while minimizing the disruption to your users if you do need to force log out sessions.

I know dealing with potential hacks or unauthorized access can be stressful, but you‘ve got this! With the steps and recommendations outlined above, you have the tools to respond quickly and proactively protect your WordPress site.

If you have any other questions about WordPress security or troubleshooting, feel free to ask. I‘m here to help! Now go forth and keep those user sessions and passwords locked down tight.

Did you like this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

The Ultimate Guide to Adding Signature Ads in WordPress for More Clicks & Sales
The Ultimate Guide to Creating High-Converting Location-Based Popups in WordPress (2026)
What is Multisite? How to Create WordPress Multisite Network
How to Start a Video Blog (Vlog) And Make Money in 2026
How to Use WebP Images in WordPress (3 Methods)
How to Create and Sell Ebooks in WordPress from Start to Finish
How to Showcase Your Authors in WordPress (2 Easy Methods)
What Is a WordPress Backup? The Complete Beginner‘s Guide

Related

Recent Posts

  • From Blog Post to Share Card: Why Open Graph Images Belong in Your Publishing Pipeline
  • Decodo Review 2026: Pricing, Proxy Types, Performance, and Real-World Fit
  • Grilla Grills: Innovating Backyard Barbecue with Community-Driven Design
  • A Comprehensive Guide to All Outriders Missions and Side Quests
  • A Front-Row Ticket to the World of AI: Empowering You, the Future Innovators
  • ChatGPT 5 and Beyond: OpenAI’s Five-Level Roadmap to AGI Unveiled
  • Accessing the Power of GPT-3: An AI Expert‘s Guide
  • Mastering the Skies: Your Ultimate Guide to Obtaining the Voyager Hull in Tower of Fantasy
  • How to Use Kipper AI for Free
  • Shopcodes 2.0: Revolutionizing Mobile Commerce in 2026 and Beyond
  • Fire Emblem Engage Differs Greatly from Three Houses
  • The Ultimate Guide to Writing Compelling Meta Descriptions in 2026
  • The Ultimate Guide to B2B Affiliate Marketing: Strategies for Success in 2026 and Beyond
  • Unveiling the Mysteries: A Comprehensive Guide to the Passage of the Ghouls Sacred Seal Locations in Genshin Impact
  • 21 Best Instagram Video Downloader in 2026
  • Microsoft Edge vs Firefox in 2026: Which Browser is Better?
  • 15 Best Zombie Games for Nintendo Switch
  • Top 6 Games Like Luigi’s Mansion 3 for Scary Trip
  • Shop Cash Expands to the Web: Revolutionizing Online Retail in 2026
  • Diablo 4: Champion‘s Demise Dungeon – An In-Depth Guide
  • Mastering System Design Interviews with ChatGPT: Designing a Twitter-like Platform for 2026
  • Google Bard AI Chatbot: An Expert‘s In-Depth Perspective
  • The Ultimate Guide to ChatGPT Prompt Engineering in 2026: Unlocking AI’s Full Potential
  • Escape the Backrooms: The Ultimate Survival Guide (2026-2026 Edition)

About Us | Contact Us | Privacy Policy

©RickySpears.com 2023. All rights reserved.