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

WordPress Trac noreply at wordpress.org
Mon Jan 26 17:20:41 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 boonebgorges):

 I'm thinking:

 {{{
 $q = new WP_Query( array(
     'meta_query' => array(
         array(
             'key' => 'foo',
             'value' => 'foo value',
             'alias' => 'foo',
         ),
         array(
             'key' => 'bar',
             'value' => 'bar value',
             'alias' => 'bar123',
         ),
     ),
     'orderby' => array(
         'foo' => 'ASC',
         'bar123' => 'DESC',
     ),
 ) );
 }}}

 I believe the 'table_aliases' array is a flat array that's mainly used for
 counts and incrementing. It doesn't store any associations with the query
 clauses. I'm not sure if that'll be sufficient - needs testing.

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


More information about the wp-trac mailing list