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

WordPress Trac noreply at wordpress.org
Sat Jan 5 12:01:36 UTC 2019


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

Comment (by boonebgorges):

 Thanks, @mgibbs189. [attachment:"38034.5.diff"] feels like a lot of
 changes for what seems like a fairly small bit of logic.
 [attachment:"38034.6.diff"] is another approach:

 - Remove special handling for `post__in`, `post_parent__in`, and
 `post_name__in` in `parse_orderby()`, and move the clause generation to
 the `switch` block where other `orderby` values are handled
 - For these values of `orderby`, force `order` to an empty string. Do this
 in `get_posts()` instead of passing the values around and doing it in
 `parse_order()`, etc. Note that I'm forcing an empty string rather than
 respecting the value of `order` passed to the function: it was decided as
 part of #39055 that `order` would be ignored in these cases (a decision I
 agree with). See https://core.trac.wordpress.org/ticket/39055#comment:13
 and [40056]
 - Fix a REST API test that was sensitive to the whitespace in the
 generated SQL clause

 Could you have a look to see whether this approach makes sense to you, and
 whether it works?

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


More information about the wp-trac mailing list