This page redirects to an external site: https://developer.wordpress.org/reference/hooks/login_url/
login_url is a filter applied to the url returned by the function wp_login_url()
The following example would return a login URL http://example.com/my-login-page/ for the wp_login_url() function:
add_filter( 'login_url', 'my_login_page', 10, 3 );
function my_login_page( $login_url, $redirect, $force_reauth ) {
return home_url( '/my-login-page/?redirect_to=' . $redirect );
}
Same as above, but uses the add_query_arg() function for adding the redirect_to parameter and is expanded for readability.
add_filter( 'login_url', 'my_login_page', 10, 3 );
function my_login_page( $login_url, $redirect, $force_reauth ) {
$login_page = home_url( '/my-login-page/' );
$login_url = add_query_arg( 'redirect_to', $redirect, $login_page );
return $login_url;
}
Since: Version 2.8
Since: Version 4.2 The `$force_reauth` parameter was added.
login_url is located in wp-includes/general-template.php