One Lock, One Key: Why a WordPress Login Breaks From a Single Wrong Return
The Problem A developer adds a custom check to the authenticate filter — say, blocking login for users with an unverified email. The simplest approach: return false if…

Action Hook since 1.5.1
Fires after a user logs out
wp_logout is the mirror of wp_login — use it to clear per-user cookies, caches, or add custom redirect logic.
Runs inside wp_logout() after wp_clear_auth_cookie() and wp_destroy_current_session(), just before any redirect on wp-login.php?action=logout.
do_action( 'wp_logout', int $user_id );$user_id int — ID of the user who just logged out.add_action( 'wp_logout', function( $user_id ) {
delete_transient( 'user_session_' . $user_id );
} );Clear a custom per-user transient on logout.
add_action( 'wp_logout', function() {
wp_safe_redirect( home_url() );
exit;
} );Send the user home instead of back to the default wp-login.php screen after logout.
The Problem A developer adds a custom check to the authenticate filter — say, blocking login for users with an unverified email. The simplest approach: return false if…
Yes — hook wp_logout (or the logout_redirect filter for more control over the target URL) and call wp_safe_redirect() followed by exit.
Source: wp-includes/pluggable.php
One session: this hook, then each related_hooks entry. Walk it and tell us what to change.
wp_logout → wp_login
Practice the wp_logout WordPress action hook in our interactive sandbox — a VS Code-style editor with a step-by-step wp_logout tutorial, add_action exercises, and instant feedback. No local WordPress install required.