If you’re a WordPress administrator and encounter a situation where you want to forcefully logout all users at once without having to ask them to do it manually, here’s how to do it.
- Login to your server and go to the WordPress root directory.
- Open the wp-config.php file and look for a code block that looks similar to the one given below (has values will differ):
define('AUTH_KEY', 'rh g-x+@l:6gpCOjO)s2L(1uB=Op*6$]E}uK5;laEMmo#c%-/[zUrb+eu1Xpl]6&');
define('SECURE_AUTH_KEY', 'j?#nlmj(R p}B(9r|tN$gqTRw%{XR+ixRxHozKxo $?r@Uo+MNdri,]J@.{d-Bu|');
define('LOGGED_IN_KEY', 'xEDHDW/t,2Z8T<N0#s)+S4p=.fR0=;89$~F@:YrFZQ5.=>$IM_8V)`%`ontwaxB]');
define('NONCE_KEY', '|y-2+LOszpUks?)|KjV=]$#89u!/a3wlj30X&cxD>5EK^qx].D[x=3-(cB!.cY)z');
define('AUTH_SALT', 'vhCm9)_5i;,sawsGGbA8CefceDB$H-W|Zw@fJPMpey:BjnSxsX9^52R0wG7:e>S~');
define('SECURE_AUTH_SALT', 'lYZHGOqOU)J]1/w&BA]aCN e)-^}Z5m,p5CS]d!rN|YaookF6_~+{_=X!FB#q03}');
define('LOGGED_IN_SALT', '++3Gs/Mc-*LI~4+UEk]2AsOGv0Z7K=nm8VcZT&z^#:p_S19JfMOtA=N2$/t2 y?K');
define('NONCE_SALT', '+$op5|=<M+0HVq|]I-!?8IBe|WMmotSwM=yz(#nD(u3>+gn-2^=&+MbYqY)+!5_i');
PHP- Go to the WordPress secret key generator API and copy the entire code block generated on that page.
4. Now replace the code block in wp-config.php file with the new one generated in step 3 and save the file.
That’s it! All logged in sessions will be terminated and all users will be forcefully logged out.