[wp-trac] [WordPress Trac] #56400: Rename is_admin() and related functions for clarity
WordPress Trac
noreply at wordpress.org
Thu Sep 22 19:05:38 UTC 2022
#56400: Rename is_admin() and related functions for clarity
--------------------------------+-----------------------------
Reporter: SergeyBiryukov | Owner: SergeyBiryukov
Type: enhancement | Status: accepted
Priority: normal | Milestone: 6.1
Component: Bootstrap/Load | Version:
Severity: normal | Resolution:
Keywords: 2nd-opinion revert | Focuses:
--------------------------------+-----------------------------
Comment (by azaozz):
Replying to [comment:13 SergeyBiryukov]:
> Thanks for flagging this! With these considerations, I agree `_request`
makes more sense.
Actually thinking more about it, this will not bring any benefits, just
confusion. There are probably thousands of references to `is_admin` and
the similar in books, posts, plugins, everywhere. Breaking these
references is like breaking links: very bad UX :)
Another reason is that the `is_admin` is "open ended", i.e. it means all
of these:
- is-admin-user (authenticated user is making the request)
- is-admin-request
- is-admin-page that may be loaded
- can-use-functions-that-are-only-available-in-admin-context
- is-not-front-end request/page
Changing it to `is_admin_request` doesn't make it better and will not
convey all these meanings. The same is true for `is_login`. I don't agree
with Nacin's comment there that is may be confusing. It just needs better
explanation in the docblock.
Also see https://core.trac.wordpress.org/ticket/55883#comment:21 about
general sentiment about renaming functions and variables that have existed
for many many years. There may be some that would be way better, but
generally think it brings a lot of confusion (especially for new
contributors) that will not go away in the future as it breaks all
existing references.
In these terms I'd like to propose that this is reverted and closed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56400#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list