[wp-trac] [WordPress Trac] #55956: Pass $maybe_orderby_meta into 'get_terms_orderby' filter

WordPress Trac noreply at wordpress.org
Thu Jun 9 15:56:19 UTC 2022


#55956: Pass $maybe_orderby_meta into 'get_terms_orderby' filter
-----------------------------+-----------------------------
 Reporter:  johnjamesjacoby  |      Owner:  (none)
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Taxonomy         |    Version:  2.8
 Severity:  normal           |   Keywords:  2nd-opinion
  Focuses:                   |
-----------------------------+-----------------------------
 The `get_terms_orderby` filter in `get_terms()` doesn't get passed the
 `$maybe_orderby_meta` parameter.

 If a plugin wants to use the `$maybe_orderby_meta` parameter when
 filtering the terms order, it must also filter `get_terms_args` and add
 the`$maybe_orderby_meta` argument to the `$args` array, so it can
 subsequently use it in the `get_terms_orderby` filter.

 ----

 It would be additionally helpful to also pass `$orderby_raw` into the same
 filter, which would help plugin authors identify if `$orderby` had already
 been filtered or overridden.

 ----

 Tangentially, the location of this filter is such that ordering by meta
 will always override it. A code comment says:

 {{{
 // Run after the 'get_terms_orderby' filter for backward compatibility.
 }}}

 ...and I am sure that is the case, but I wonder if a back-compat break
 here would be fine, or whether maybe a newer, better filter at the end of
 that method would be best?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55956>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list