Login and Registration: Rename is_login_screen() function to is_login().

As the function can be used in a variety of contexts, the `_screen` suffix may not always be appropriate.

This commit aims to reduce confusion by renaming the newly added `is_login_screen()` function to `is_login()`, which better aligns with `is_admin()` and the related `is_*_admin()` function family.

While it does not save a lot of lines of code, this function aims to save developers some time that would otherwise be spent investigating the most reliable way to determine whether the current request is for the login screen.

Implementation details:
* By checking `wp_login_url()`, the function accounts for custom login locations set via the `login_url` filter.
* By checking `$_SERVER['SCRIPT_NAME']` directly, instead of `did_action( 'login_form_login' )` or `$pagenow` global, the function can work as early as possible, for example in a must-use plugin.

Follow-up to [53884].

Props azaozz.
Fixes #19898. See #56400.
Built from https://develop.svn.wordpress.org/trunk@54447


git-svn-id: http://core.svn.wordpress.org/trunk@54006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-10-10 17:59:12 +00:00
parent d161399285
commit e7da835a36
2 changed files with 2 additions and 2 deletions

View File

@ -1150,7 +1150,7 @@ function wp_clone( $object ) {
*
* @return bool True if inside WordPress login screen, false otherwise.
*/
function is_login_screen() {
function is_login() {
return false !== stripos( wp_login_url(), $_SERVER['SCRIPT_NAME'] );
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-beta3-54446';
$wp_version = '6.1-beta3-54447';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.