[wp-trac] [WordPress Trac] #31045: Ordering a Query Using Multiple Meta Keys
WordPress Trac
noreply at wordpress.org
Mon Jan 26 16:33:50 UTC 2015
#31045: Ordering a Query Using Multiple Meta Keys
------------------------------------------+-----------------------------
Reporter: Funkatronic | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Future Release
Component: Query | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+-----------------------------
Changes (by boonebgorges):
* keywords: needs-patch => needs-patch needs-unit-tests
Comment:
Cool, thanks for the initial patch. For syntax, we should tap into the
existing WP_Query orderby code. Check out `parse_orderby()`
https://core.trac.wordpress.org/browser/tags/4.1/src/wp-
includes/query.php#L2207. It gets a "primary_meta_key" from the meta query
and checks it against the keys passed to orderby. We need to keep some of
this logic, because `orderby=meta_value` will continue to work this way.
But for the more general case, I suppose we'll have to loop through the
meta query clauses and compile a list of available aliases.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31045#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list