[wp-trac] [WordPress Trac] #32659: Orderby meta clause in meta_query not working in 4.2.2

WordPress Trac noreply at wordpress.org
Tue Jun 16 11:54:59 UTC 2015


#32659: Orderby meta clause in meta_query not working in 4.2.2
-----------------------------------------+-----------------------------
 Reporter:  dariopad                     |      Owner:
     Type:  defect (bug)                 |     Status:  new
 Priority:  normal                       |  Milestone:  Awaiting Review
Component:  Query                        |    Version:  4.2.2
 Severity:  normal                       |   Keywords:
  Focuses:  administration, performance  |
-----------------------------------------+-----------------------------
 Hi, I'm trying to get results ordered by meta clauses and post date in a
 WP_Query with custom fields meta_query. It should work from 4.2 on but it
 doesn't for me. Any suggestion on the query below would be appreciated:

 Is that a bug?

 {{{
 $args = array ( [...],
   'meta_query' => array(
        'relation' => 'OR'
        'my_clause' => array(
                array( 'key' => 'any_key', 'compare' => '=', 'value' =>
 '1', 'type' => 'CHAR')
                array( 'key' => 'another_key', 'compare' => '=', 'value' =>
 '1', 'type' => 'CHAR')
            ),
         'another_clause' => array(
                array( 'key' => 'any_other_key', 'compare' => '=', 'value'
 => '1', 'type' => 'CHAR')
             )
     ),
     'orderby' => array('my_clause'=>'DESC', 'post_date'=>'DESC')
  );
 }}}

 '''References:'''
 [https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2
 -orderby-and-meta_query/]
 [https://make.wordpress.org/core/2014/08/29/a-more-powerful-order-by-in-
 wordpress-4-0/]

 '''Use Case:'''
 [http://www.glocalmart.it/]

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32659>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list