[wp-trac] [WordPress Trac] #56400: Rename is_admin() and related functions for clarity

WordPress Trac noreply at wordpress.org
Thu Sep 22 21:02:48 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 jrf):

 @azaozz I agree that causing confusion isn't good and that existing code
 should not be impacted by this change, but I also agree with
 @SergeyBiryukov that that confusion already exists and that people often
 don't fully realize what those functions do and use them incorrectly.

 Updating the docs IMO is not a solution, as, if people would read the
 docs, they wouldn't used the wrong function in the first place, but it
 still happens.

 [https://core.trac.wordpress.org/ticket/56400#comment:2 As I said before
 in this discussion], I don't think the original functions should be
 deprecated, but I do think having some aliases which allow for more
 descriptive code/are more self-explanatory would not necessarily be a bad
 thing.

 You mention the low adoption of the new name in
 [https://core.trac.wordpress.org/ticket/55883#comment:21].
 I don't think these changes are comparable as:
 1. `apply_shortcode()` IMO is actually less descriptive than
 `do_shortcode()`.
 2. The new function only being mentioned in one dev-note still makes it
 relatively unknown.
 3. As the "old" function wasn't deprecated, there is no incentive for
 developers to update existing code.

 An ''honest'' comparison of the uptake would need to compare the use of
 the "old" function at the time the rename was introduced vs now, to see
 the number of new uses which have been introduced between then and now and
 how many of those use the "old" function name vs the "new" function name.
 As the "old" numbers aren't mentioned anywhere in that thread, such a
 comparison is not possible, so no value can be attached to the ''current''
 usage numbers.

 So, what about this ?
 * Revert most of the changes in this ticket, except for the adding of the
 alias `is_super_admin_user()`.
 * Document in this ticket the number of usages found in plugins and themes
 at this time.
 * Publish a dev-note about the change.
 * Update existing documentation which contains example code for
 plugins/themes which uses the `is_super_admin()` to use the new function
 name.
 * Revisit this ticket after 5/6 releases and do an honest comparison of
 the numbers based on the plugin/theme usage then compared to now (without
 presuming people will update existing code).

-- 
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