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…

Filter Hook since 2.8.0
Filters the login page URL
login_url is how membership and white-label sites hide wp-login.php. Return a full URL, not a path fragment.
Whenever wp_login_url() is built — login links, auth redirects, some REST responses.
apply_filters( 'login_url', string $login_url, string $redirect, bool $force_reauth );$login_url string — Login URL.$redirect string — Redirect destination after login.$force_reauth bool — Whether to force re-authentication.add_filter( 'login_url', function( $url ) {
return home_url( '/my-login/' );
} );Send login links to a custom page instead of wp-login.php.
add_filter( 'login_url', function( $login_url, $redirect ) {
$url = home_url( '/my-login/' );
if ( $redirect ) {
$url = add_query_arg( 'redirect_to', urlencode( $redirect ), $url );
}
return $url;
}, 10, 2 );Preserve the redirect_to parameter when rewriting the login URL.
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…
Only if something still links to it directly. This filter changes what wp_login_url() outputs; it doesn't disable the real wp-login.php endpoint.
Source: wp-includes/general-template.php
One session: this hook, then each related_hooks entry. Walk it and tell us what to change.
login_url → admin_init
Practice the login_url WordPress filter hook in our interactive sandbox — a VS Code-style editor with a step-by-step login_url tutorial, add_filter exercises, and instant feedback. No local WordPress install required.