[wp-trac] [WordPress Trac] #28589: Warning on Usage of WP_Query() with Orderby Array

WordPress Trac noreply at wordpress.org
Mon Sep 1 08:50:12 UTC 2014


#28589: Warning on Usage of WP_Query() with Orderby Array
--------------------------+-----------------------
 Reporter:  behrang       |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:
Component:  Query         |     Version:  3.9.1
 Severity:  normal        |  Resolution:
 Keywords:  close         |     Focuses:
--------------------------+-----------------------
Changes (by steffenborup):

 * status:  closed => reopened
 * resolution:  invalid =>


Comment:

 The codex does indicate that it is possible to pass an array to 'orderby',
 though:

   '''Mulitiple orderby/order pairs'''
   'orderby' => array( 'meta_value_num' => 'DESC', 'title' => 'ASC' ),
 'meta_key' => 'age'

 In the description of "Order & Orderby Parameters" the codex also states
 the following:

   '''order''' (string | array) - Designates the ascending or descending
 order of the 'orderby' parameter. Defaults to 'DESC'. An array can be used
 for multiple order/orderby sets.

 But when passing an array to 'order' I receive the following warning:
   Warning: strtoupper() expects parameter 1 to be string, array given in

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


More information about the wp-trac mailing list