is_login()
Checks if the user is on the WordPress admin login page.
The function was proposed to be created in 2012 in ticket #19898.
1 time — 0.002949 sec (very slow) | 50000 times — 0.68 sec (very fast)
No Hooks.
Returns
true|false.
True- user is on the WordPress admin login pagefalse- otherwise.
Usage
if ( is_login() ){
// ...
}
Examples
#1 Place a welcome message on the login page
add_action( 'init', 'add_text_to_login' );
function add_text_to_login() {
if ( is_login() ) {
echo '<h1>Welcome to the login page!</h1>';
}
}
Notes
- See: wp_login_url()
Changelog
| Since 6.1.0 | Introduced. |
is_login() is login code WP 6.9
function is_login() {
return false !== stripos( wp_login_url(), $_SERVER['SCRIPT_NAME'] );
}