Login and Registration: Introduce `is_login_screen()` function.
This should help determine whether the current request is for the login screen. While it does not save a lot of lines of code, including this function in core aims to save developers some time that would otherwise be spent investigating the most reliable way to solve this problem. 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 [2481], [6412], [12393], [12732], [15558], [15481], [15746]. Props dcowgill, scribu, donmhico, iandunn, wonderboymusic, nacin, robmiller, kitchin, chriscct7, tazotodua, davidbaumwald, SergeyBiryukov. Fixes #19898. Built from https://develop.svn.wordpress.org/trunk@53884 git-svn-id: http://core.svn.wordpress.org/trunk@53443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
20edeb6e09
commit
d7f5fe1283
|
@ -1140,6 +1140,19 @@ function wp_clone( $object ) {
|
|||
return clone( $object );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_screen() {
|
||||
return false !== stripos( wp_login_url(), $_SERVER['SCRIPT_NAME'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the current request is for an administrative interface page.
|
||||
*
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-alpha-53883';
|
||||
$wp_version = '6.1-alpha-53884';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue