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

WordPress Trac noreply at wordpress.org
Sun Dec 4 17:24:04 UTC 2016


#39055: REST API: order is ignored when orderby is set to include
--------------------------+-----------------------------
 Reporter:  joshlevinson  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The API currently supports the ability `orderby=include` as long as you've
 specified an array of post IDs to `include`. In this scenario,`order` is
 ignored–results are always returned in the same order as the IDs of the
 `include` array.

 A tester reported an expectation that if `orderby` is set to `include` and
 `order` is `desc`, that the results would effectively be the "opposite" of
 the `include` array.

 For example:
 `include=5,2,1&orderby=include` and
 `include=5,2,1&orderby=include&order=desc`
 currently returns results like: ` [ { id: 5...}, { id: 2...}, { id: 1... }
 ]`

 If `order` is respected, specifying `order=desc`
 would return results like: ` [ { id: 1...}, { id: 2...}, { id: 5... } ]`
 ''(the "opposite" of the array)''

 Note that this behavior was brought up in testing the REST API, but it is
 not specific to the API. The current behavior is present in `WP_Query`, so
 if it is deemed that this behavior should change, it should probably be
 changed in `WP_Query` rather than the API.

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


More information about the wp-trac mailing list