Make WordPress Core

Opened 5 months ago

Last modified 5 months ago

#63890 new enhancement

Add multiple order conditions to WP_Term_Query

Reported by: oglekler's profile oglekler Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch needs-testing
Focuses: Cc:

Description

Now WP_Term_Query accepts orderby only as a string, as WP_Query accepts an array.

Use case: I need to sort by term meta plus title. I cannot sort after getting the terms because I am not getting meta with terms, and requesting meta for each term will be unproductive.

Change History (2)

This ticket was mentioned in PR #9658 on WordPress/wordpress-develop by @abcd95.


5 months ago
#1

  • Keywords has-patch added

#2 @abcd95
5 months ago

  • Keywords needs-testing added

Thanks, @oglekler, for the enhancement suggestion.

I observed the WP_Query structure closely and attempted to replicate something similar with the WP_Term_Query. I have tested all edge cases as much as I could. I'm gonna go ahead and add the needs-testing label so that others can also take a swing at this and see if this breaks anything else while I am preparing automated tests for this.

Note: See TracTickets for help on using tickets.