is_login()WP 6.1.0

Determines whether the current request is for the login screen.

1 time — 0.002949 sec (very slow) | 50000 times — 0.68 sec (very fast)

No Hooks.

Return

true|false. True if inside WordPress login screen, false otherwise.

Usage

is_login();

Examples

-11

#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

Changelog

Since 6.1.0 Introduced.

is_login() code WP 6.6.2

function is_login() {
	return false !== stripos( wp_login_url(), $_SERVER['SCRIPT_NAME'] );
}