[wp-trac] [WordPress Trac] #17065: Independent ASC/DESC in multiple ORDER BY statement.

WordPress Trac noreply at wordpress.org
Mon Mar 16 17:02:19 UTC 2015


#17065: Independent ASC/DESC in multiple ORDER BY statement.
----------------------------+-----------------------
 Reporter:  ericmann        |       Owner:  ericmann
     Type:  task (blessed)  |      Status:  closed
 Priority:  normal          |   Milestone:  4.0
Component:  Query           |     Version:  3.1
 Severity:  normal          |  Resolution:  fixed
 Keywords:  has-patch       |     Focuses:
----------------------------+-----------------------

Comment (by joshcanhelp):

 I can also confirm that this is not working for me when I try to sort by
 date, then by meta_value. In a pre_get_posts action:


 {{{
 if ( version_compare( get_bloginfo( 'version' ), 4.0, 'ge' ) ) {
     $query->set( 'meta_key', 'wpri_rating' );
     $query->set( 'orderby', array(
         'post_date'           => 'DESC',
         'meta_value_num' => 'DESC'
      ) );
 }
 }}}

 It sorts by date but not by meta_value

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


More information about the wp-trac mailing list