[wp-trac] [WordPress Trac] #38034: post__in orderby not working when passed in an array to orderby

WordPress Trac noreply at wordpress.org
Sat Mar 11 03:34:21 UTC 2017


#38034: post__in orderby not working when passed in an array to orderby
--------------------------+-----------------------------
 Reporter:  kelvink       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Query         |     Version:  4.6
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------------
Changes (by boonebgorges):

 * keywords:  reporter-feedback => needs-patch
 * milestone:  Awaiting Review => Future Release


Comment:

 I'm unable to reproduce the problems described by @AllysonSouza and
 @maccast. It's possible that they indicate some other issue.

 What @kelvink describes is, indeed, a problem, and the approach in the
 patch looks correct. I'm about to attach a patch that also contains a test
 demonstrating the issue.

 However, the patch causes some other orderby tests to fail. The reason is
 this. Once you start treating `post__in` as a "regular" orderby value
 instead of a special case, it means that you automatically start
 inheriting the `order` parameter too. And since the default `order` param
 is `DESC`, `WP_Query( array( 'orderby' => 'post__in' ) )` starts returning
 results in reverse. This is too big a backward compatibility break. So we
 need to add some logic somewhere that indicates  that when you pass
 `orderby=post__in` but don't specify `order`, you intend the order to be
 `ASC`.

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


More information about the wp-trac mailing list