[wp-trac] [WordPress Trac] #39055: REST API: order is ignored when orderby is set to include

WordPress Trac noreply at wordpress.org
Sat Jan 28 17:03:28 UTC 2017


#39055: REST API: order is ignored when orderby is set to include
--------------------------+------------------
 Reporter:  joshlevinson  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  4.8
Component:  Query         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------
Changes (by fibonaccina):

 * keywords:  has-patch needs-unit-tests => has-patch


Comment:

 @jnylen0 If I understand correctly the intended behavior is to return the
 results in the same order as the include array (even if this input array
 isn’t sorted), by default. For example, if include=2,5,1 we should get the
 posts in this order: 2,5,1. When adding order=asc, the order should be the
 same as that in the include array (ex. 2,5,1). If we add order=desc, the
 order should be the reverse of the include array (ex 1,5,2).

 Do I have this right? Happy to update the tests if this is not correct!
 The tests are failing right now, as the posts are returned in a sorted
 array even if the include array isn’t sorted. As well, the default
 behavior (when order is omitted) mimics desc order, not asc.

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


More information about the wp-trac mailing list