WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
  • Deals
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» How to Force Logout All Users in WordPress

How to Force Logout All Users in WordPress

Last updated on December 28th, 2017 by Editorial Staff
113 Shares
Share
Tweet
Share
Special WordPress Hosting offer for WPBeginner Readers
How to Force Logout All Users in WordPress

Do you want to force logout all users in WordPress? If you suspect that your WordPress may be hacked or just need users to login again, then there is no default option to do that in WordPress. In this article, we will show you how to easily force logout all users in WordPress.

Why and When You May Want to Force Log out All Users in WordPress?

If you run a WordPress membership site or an LMS plugin, and you need all logged in users to re-login, then this tutorial is for you.

You may want to do this for different reasons. For example, if you suspect that your WordPress site is hacked, then forcing logout will allow you to properly clean up your hacked WordPress site.

Next, if you are using a membership or pay per view site and fear that users may be sharing their passwords to access content, then this method will come in handy. After logging them out, you can stop them from sharing passwords.

Another scenario is that when you use a public computer or WiFi without using a VPN service. If you are not sure that you properly logged out, then this method will end all logged in sessions.

That being said, let’s take a look at how to easily logout all users in WordPress.

Force Log Out All WordPress Users

For this tutorial, you will be editing WP Config file called wp-config.php. We highly recommend that you backup your wp-config.php file before making any changes to it.

First you will need to connect to your website using FTP or via File Manager in cPanel. Once connected, you will find the wp-config.php file in your site’s root folder.

Editing wp-config.php file via FTP

You can right click and select edit to open the file in a text editor.

Inside your wp-config.php file you will find a code block that would look like this:

define('AUTH_KEY',         'K2#m<|[UO==4Nv c+Ox+^]NH.H*6DmQRJntnj|SwKg)>,>O-z/IeRr?>5lmx`Hf:');
define('SECURE_AUTH_KEY',  '-Qf(}6G(zB`(D*)]fe;iEw?M]PU>BY:$Ni6]~mYCfZ68l_M@R<5E_ICbPUVk.Vf@');
define('LOGGED_IN_KEY',    '6R6:bur.^!Q1K-/H!$]A$g3JaaO]r|B&zu~{-*})|+C|<V,^c|f^vlhp$urvTr7>');
define('NONCE_KEY',        'LM7}+||^qoISh4#q_ ST%#x0vke+TQD(^$W{lVQ_TyV!%,N++H)4+>uSZl6Z%W[3');
define('AUTH_SALT',        'PpS;19y?W31AY@:=,RC;&0kkNXNkP -v=Lr;ghGft:?WV5vA-lje|h{A19Tfzq$[');
define('SECURE_AUTH_SALT', '+H.u}x4u<6-^HY+<?oRkZ{9T)E_)rR+uy.3Rpm*Z&S|UUO|5Wh6cn9.2pq+o4P[M');
define('LOGGED_IN_SALT',   'I{uT;rv5S`JRRs}=1+Ls_3YMDR^;|U[&x^Oy!yg2-:BO%|0W@c-n|SY8D3zo7-8-');
define('NONCE_SALT',       ':0Y`/h3JhwMRNCj~z[1}N@5QKp0|-s4C+XR~/-q6PfZ&Q.qFY5-]qS|L,CNbv>/z');

It is also possible that each of these lines just have ‘put your unique phrase here’ as the second parameter.

These lines are called authentication keys and salts. To learn more about them see our guide on WordPress security keys.

Next, you need to visit the WordPress Salts generator page. This page randomly creates new key strings that you can use in your wp-config.php file.

Generating WordPress security keys

You need to replace your existing keys with the new ones that you just generated. Once done, make sure to save your changes and upload your wp-config.php file back to the server.

Changing the salts will automatically log everyone out of your website, forcing them to relogin.

Improving Password Security for All Users on Your WordPress Site

If you run a membership website or allow users to register on your site, then users are likely to use easy to remember and weak passwords.

Weak passwords are easy to crack and pose a security challenge for your website.

If you suspect that your website is hacked, then you may want to safely reset passwords for all users on your WordPress site. This will allow them to generate new passwords for their accounts.

However, users can still use the same password that they had before. To avoid this from happening again, you can enforce strong passwords for all users on your WordPress site.

One of the most common question we get whenever we recommend using strong passwords is how to remember all those difficult passwords?

The answer is simple, you don’t need to. There are apps available that can manage passwords for you. See our guide on how to manage WordPress passwords for more on this topic.

We hope this article helped you learn how to force logout all users in WordPress. You may also want to see our complete step by step WordPress security guide for beginners.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

113 Shares
Share
Tweet
Share
Popular on WPBeginner Right Now!
  • Why Build Your Email List Today

    Revealed: Why Building Your Email List is so Important Today!

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

The Ultimate WordPress Toolkit

Comments

  1. Congratulations, you have the opportunity to be the first commenter on this article.
    Have a question or suggestion? Please leave a comment to start the discussion.

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 600,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
WPForms Logo
WPForms
Drag & Drop WordPress Form Builder Plugin. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 25 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2018 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2018)
    • Which is the Best WordPress Slider? Performance + Quality Compared
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • 5 Best VPN Services for WordPress Users (Compared)
    • HostGator Review - An Honest Look at Speed & Uptime (2018)
    • SiteGround Reviews from 1032 Users & Our Experts (2018)
    • Bluehost Review from Real Users + Performance Stats (2018)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Start a Podcast with WordPress (Step by Step)
    • How to Choose the Best Domain Name (8 Tips and Tools)
    • How to Setup a Professional Email Address with Google Apps and Gmail
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2018 – Step by Step Guide
Deals & Coupons (view all)
Pippity
Pippity Coupon
Save 25% off on Pippity, the ultimate lead generation plugin for WordPress.
Soliloquy Logo
Soliloquy Coupon
Get 10% off Soliloquy, the best responsive WordPress slider plugin available in the market.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • List25
  • Awesome Motive
  •  

Copyright © 2009 - 2018 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

WordPress hosting by HostGator | WordPress CDN by MaxCDN | WordPress Security by Sucuri.