Opened 2 years ago
#55956 new enhancement
Pass $maybe_orderby_meta into 'get_terms_orderby' filter
Reported by: | johnjamesjacoby | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 2.8 |
Component: | Taxonomy | Keywords: | 2nd-opinion |
Focuses: | Cc: |
Description
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?