[wp-trac] [WordPress Trac] #29424: Query argument 'orderby' makes duplicated parameters possible

WordPress Trac noreply at wordpress.org
Mon Sep 1 19:20:29 UTC 2014


#29424: Query argument 'orderby' makes duplicated parameters possible
-------------------------------------------------+-------------------------
 Reporter:  ChriCo                               |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Query                                |  Review
 Severity:  normal                               |     Version:  2.5
 Keywords:  needs-patch needs-testing needs-     |  Resolution:
  unit-tests                                     |     Focuses:
-------------------------------------------------+-------------------------
Changes (by johnbillion):

 * version:  trunk => 2.5
 * milestone:  4.0 => Awaiting Review


Comment:

 This orderby parameter is ambiguous at best and erroneous at worst:
 {{{
 'orderby' => array(
     'title' => 'DESC',
     'post_title' => 'ASC'
 )
 }}}
 If you're performing a query such as this then your code is incorrect.
 What is the expected value of the `ORDER BY` clause in this case?
 [attachment:29424.2.diff] actually makes this behaviour even more
 confusing, because it silently discards the second of the duplicated
 fields.

 For these reasons, we don't plan to handle such values in this parameter
 and the current behaviour won't be changed.

 Regarding the missing fields available in the `orderby` parameter
 ("date_gmt", "post_status", "modifed_gmt", "content_filtered",
 "mime_type", "post_type"), this is not a change in 4.0, so I'm punting
 this ticket while I look to see if this has already been reported in
 another ticket.

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


More information about the wp-trac mailing list