WordPress Version: 6.1
/**
* Determines whether the current request is for the login screen.
*
* @since 6.1.0
*
* @see wp_login_url()
*
* @return bool True if inside WordPress login screen, false otherwise.
*/
function is_login()
{
return false !== stripos(wp_login_url(), $_SERVER['SCRIPT_NAME']);
}