[wp-trac] [WordPress Trac] #19898: Create an is_login_screen() function similar to is_admin()
WordPress Trac
noreply at wordpress.org
Thu Aug 11 21:49:23 UTC 2022
#19898: Create an is_login_screen() function similar to is_admin()
------------------------------------+-----------------------------
Reporter: dcowgill | Owner: SergeyBiryukov
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.1
Component: Login and Registration | Version: 3.3
Severity: normal | Resolution: fixed
Keywords: 2nd-opinion has-patch | Focuses:
------------------------------------+-----------------------------
Changes (by SergeyBiryukov):
* status: reviewing => closed
* resolution: => fixed
Comment:
In [changeset:"53884" 53884]:
{{{
#!CommitTicketReference repository="" revision="53884"
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.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/19898#comment:34>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list