WordPress action hook · part of WordPress core
wp_logout
A WordPress core action that 14 plugins also fire themselves, running on 857K+ sites between them.
“Fires after a user is logged out.”
How to use wp_logout
It's an action: your callback runs at that point and receives 1 argument. Nothing needs to be returned.
Add this to your theme's functions.php or a small custom plugin:
add_action( 'wp_logout', function( $user_id ) {
// Your code runs here.
}, 10, 1 );Argument names come from WP 2FA's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
14 plugins that fire wp_logout
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Kadence Security700,000+ installs
do_action( 'wp_logout', $current_user->ID )core/lockout.php:866 -
WP 2FA100,000+ installs
do_action( 'wp_logout', $user_id )includes/classes/Admin/Helpers/class-ajax-helper.php:597 -
WP-Members Membership Plugin50,000+ installs
do_action( 'wp_logout', $user_id )includes/class-wp-members-user.php:198 -
WP Remote Users Sync5,000+ installs
do_action( 'wp_logout', $user->ID )inc/api/class-wprus-api-logout.php:115 -
MultiManager WP2,000+ installs
do_action( 'wp_logout' )includes/class-multi-manager-wp-rest-api.php:1434 -
Only one device login limit200+ installs
do_action( 'wp_logout' )only-one-device-login-limit.php:282 -
Bitcoin, Ethereum and ERC20 crypto wallets with exchange70+ installs
do_action( 'wp_logout' )includes/functions.php:30 -
Password only login40+ installs
do_action( 'wp_logout' )index.php:92 -
WP Similar Basic Auth10+ installs
do_action( 'wp_logout' )includes/class-cookie.php:267 -
Delete My Account for Ultimate Membership Pro10+ installs
do_action( 'wp_logout' )classes/Main.php:137 -
multi-login-checker10+ installs
do_action( 'wp_logout' )single-user-login.php:50 -
WPCareers10+ installs
do_action( 'wp_logout' )include/jp_functions.php:314 -
TweakMasterFewer than 10 installs
do_action( 'wp_logout' )php/tweaks-standalone/enable-maintenance-mode.php:36 -
Siri WP SecurityFewer than 10 installs
do_action( 'wp_logout' )custom-login.php:287
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.