[wp-trac] [WordPress Trac] #31045: Ordering a Query Using Multiple Meta Keys

WordPress Trac noreply at wordpress.org
Tue Jan 27 04:05:13 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:
------------------------------------------+-----------------------------

Comment (by Funkatronic):

 New crazy idea that I think might work:
 - Every meta query clause gets aliased, even the main one.  Any `orderby`
 call to ` meta_value` will default to the first one.
 - let `WP_Meta_Query` create the `ORDER BY` clauses and store them in an
 array where the aliases are the keys
 - `parse_orderby` looks for aliases; if it finds one, it pulls the right
 clause from the meta_query object.  If it finds `meta_value` or
 `meta_value_num`, it calls the first/main clause.

 It'll take more rewriting than Id like but I think its a sound way to go
 forward.  It'll also take care of casting the `orderby` properly. Also,
 lots of testing.  Does this sound like a good idea?

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


More information about the wp-trac mailing list