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

WordPress Trac noreply at wordpress.org
Sun Mar 12 22:09:11 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:
--------------------------+-----------------------------

Comment (by maccast):

 Thanks of checking this out. Is there possibly some additional information
 or details I could provide to help determine why @AllysonSouza and I are
 seeing a different but similar issue to the one being described here?


 Replying to [comment:8 boonebgorges]:
 > 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:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list