[wp-trac] [WordPress Trac] #55098: Use meaningful variable name for "$s" and "$tax" in wp_ajax_ajax_tag_search()

WordPress Trac noreply at wordpress.org
Mon Feb 7 13:47:04 UTC 2022


#55098: Use meaningful variable name for "$s" and "$tax" in
wp_ajax_ajax_tag_search()
--------------------------+-----------------------------------------------
 Reporter:  azouamauriac  |       Owner:  (none)
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  administration, coding-standards
--------------------------+-----------------------------------------------
Changes (by SergeyBiryukov):

 * focuses:  coding-standards => administration, coding-standards
 * component:  General => Taxonomy


Comment:

 Hi there, welcome back to WordPress Trac! Thanks for the ticket.

 My initial thought here was that these particular variables seem fine as
 is:
 * `$tax` is used in many more core files as a shorthand for "taxonomy", so
 renaming it here does not seem to have a significant benefit in terms of
 consistency.
 * `$s` is also used in many core files as a reference to a search keyword.
 This matches the [source:tags/5.9/src/wp-includes/class-wp-
 query.php?marks=737-741#L736 WP_Query parameter] and a
 [source:tags/5.9/src/wp-includes/class-wp.php?marks=17#L9 public query
 variable] of the same name.

 On second thought, we do have some instances in core where similar
 variables are called `$taxonomy` and `$search`, respectively, so I guess
 we can rename these two as well for clarity. Would you like to work on a
 patch?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55098#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list