[wp-trac] [WordPress Trac] #38442: Error when WP_Query parses orderby array in function parse_order

WordPress Trac noreply at wordpress.org
Fri Oct 21 23:06:17 UTC 2016


#38442: Error when WP_Query parses orderby array in function parse_order
----------------------------+------------------------------
 Reporter:  oloynet         |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:  4.6.1
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------------------

Comment (by oloynet):

 The correct fix is

 {{{#!php
 <?php
 $primary_meta_query = false;
 foreach( $meta_clauses as $meta_clause ) {
     if ( $meta_clause['key'] == $orderby ) {
         $primary_meta_query = $meta_clause;
         break;
     }
 }
 if( ! $primary_meta_query ) {
     $primary_meta_query = reset( $meta_clauses );
 }

 }}}

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


More information about the wp-trac mailing list