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.

How to Protect Your WordPress Site by Limiting Login Access to Trusted IP Addresses
How to Properly Disable Google AMP in WordPress (Step by Step)
How to Install WordPress Locally on Your Mac (2 Methods)
14 Tested Ways to Recover WooCommerce Abandoned Cart Sales
How to Embed a Live Google Hangout in WordPress: The Ultimate Guide
How to Remove the Password Reset / Change option from WordPress
The Complete Guide to Disabling HTML in WordPress Comments (2023)
How to Export a WordPress Site (Beginner‘s Guide)

Related

Recent Posts

  • How to Merge Two WordPress Sites Together Without Losing SEO
  • The Ultimate Guide to Adding Topics to Your WordPress Navigation Menu (2023)
  • How to Properly Move from Medium to WordPress (Free Tool)
  • The All-in-One Guide to Creating a Showstopping WordPress Media Kit Page
  • The Ultimate Guide to Fixing the WordPress "Maximum Execution Time Exceeded" Error
  • The Ultimate Guide to Using Google Matched Content for Related Posts in WordPress (2023)
  • The Ultimate Beginner‘s Guide to WordPress Email Marketing Automation (2024)
  • How to Create an Online Marketplace with WordPress: The Ultimate Guide (2024)
  • Ultimate WordPress Migration Guide for Beginners (Step by Step)
  • How to Show Your MailChimp Subscriber Count in WordPress
  • The Ultimate Guide to Creating a Loyalty Program in WooCommerce (2024)
  • How to Force Logout All Users in WordPress (Simple & Easy)
  • How to Disable Login Hints in WordPress Error Messages (2023)
  • What to Do When You Are Locked Out of WordPress Admin
  • 21 Best Instagram Video Downloader in 2025
  • Microsoft Edge vs Firefox in 2025: Which Browser is Better?
  • 15 Best Zombie Games for Nintendo Switch
  • Top 6 Games Like Luigi’s Mansion 3 for Scary Trip
  • Some of the Best Content to Succeed at Growing a YouTube Channel
  • Unreal Engine Game Development: How to Make An Outstanding Game
  • What Role Can Generative AI Play in Decision-Making?
  • Staying Informed and Productive in a World That Never Sleeps
  • Generate and Maintain a Loyal Clientele Through Innovative Marketing Tactics
  • The Most Popular Types of Encryption Explained

About Us | Contact Us | Privacy Policy

©RickySpears.com 2023. All rights reserved.