[wp-trac] [WordPress Trac] #56400: Rename is_admin() and related functions for clarity
WordPress Trac
noreply at wordpress.org
Tue Sep 20 20:50:38 UTC 2022
#56400: Rename is_admin() and related functions for clarity
----------------------------------------+-----------------------------
Reporter: SergeyBiryukov | Owner: SergeyBiryukov
Type: task (blessed) | Status: accepted
Priority: normal | Milestone: 6.1
Component: Bootstrap/Load | Version:
Severity: normal | Resolution:
Keywords: needs-dev-note 2nd-opinion | Focuses:
----------------------------------------+-----------------------------
Changes (by azaozz):
* keywords: needs-dev-note => needs-dev-note 2nd-opinion
Comment:
Hmmm, I'm a bit unsure if these are good changes/renames/aliases. Adding
`_screen` doesn't really make them clearer imho. Even the new
`is_login_screen()` is not any clearer by having `screen` in there. Seems
`is_login()` or even `is_login_request()` would be more accurate :)
> `is_admin()` Determines whether the current request is for an
administrative interface page.
I agree, generally `is_admin()` means that the request is for an
"administration screen" (as opposed to a front-end screen) but the more
important meaning there is that the request was made by an authenticated
user. It is unclear if "an administrative interface page" will be loaded
as a result of that request.
Same for the other `is_*_screen` functions. They may or may not load an
admin screen, but the important part is that the requests were made by
appropriately authenticated users, imho. Perhaps instead of `_screen` it
should be `_request`? Seems a bit better and more "truthful", maybe. An
alternative would be to add `_user` to all of these but..... Not sure it
would make it clearer. For these reasons thinking that the new aliases
aren't better than the original names and may be more confusing in some
cases, perhaps?
The more important part here (imho) seems to be to add better descriptions
in the docblocks for the `is_*` functions. That would probably be way more
helpful that the aliases as the docblocks are displayed in most IDEs.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56400#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list