[wp-trac] [WordPress Trac] #40157: Batch query for media returns items in DESC order instead of post__in

WordPress Trac noreply at wordpress.org
Wed Mar 15 16:44:19 UTC 2017


#40157: Batch query for media returns items in DESC order instead of post__in
----------------------------+----------------------
 Reporter:  wonderboymusic  |       Owner:
     Type:  defect (bug)    |      Status:  closed
 Priority:  normal          |   Milestone:
Component:  REST API        |     Version:  4.7
 Severity:  normal          |  Resolution:  wontfix
 Keywords:  needs-patch     |     Focuses:
----------------------------+----------------------
Changes (by jnylen0):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  4.7.4 =>


Comment:

 From [https://wordpress.slack.com/archives/core-restapi/p1489551197969063
 Slack discussion], this is working as intended.

 > Explicit is better than implicit

 I agree with this - the order should not change based on the query
 parameters.

 > if `include` is an arg, shouldn’t `orderby` be `include` by default?
 that’s how `post__in` works internally

 I'm seeing different behavior:

 {{{
 wp> ( new WP_Query() )->query( array( 'post__in' => array( 1, 5 ),
 'fields' => 'ids' ) )
 => array(2) {
   [0]=>
   int(5)
   [1]=>
   int(1)
 }
 wp> ( new WP_Query() )->query( array( 'post__in' => array( 5, 1 ),
 'fields' => 'ids' ) )
 => array(2) {
   [0]=>
   int(5)
   [1]=>
   int(1)
 }
 }}}

 I agree with this also:

 > If you mean other uses of `WP_Query`, matching the behaviour of that is
 not a design goal

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


More information about the wp-trac mailing list