[wp-trac] [WordPress Trac] #38034: post__in orderby not working when passed in an array to orderby
WordPress Trac
noreply at wordpress.org
Tue Jan 8 03:32:09 UTC 2019
#38034: post__in orderby not working when passed in an array to orderby
--------------------------+---------------------------
Reporter: kelvink | Owner: boonebgorges
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 5.1
Component: Query | Version: 4.6
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses:
--------------------------+---------------------------
Changes (by boonebgorges):
* owner: (none) => boonebgorges
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"44452" 44452]:
{{{
#!CommitTicketReference repository="" revision="44452"
Query: Standardize treatment of 'orderby' values `post__in`,
`post_parent__in`, and `post_name__in`.
Ordering by `post__in` was introduced in [21776], but the code assumed
that
`post__in` would be a comma-separated string listing post IDs. When an
array
of post IDs was passed to the `post__in` query var, 'orderby=post__in' was
not respected. This changeset changes this behavior by handling
'orderby=post__in' in the same way as most other values of 'orderby',
which ensures that arrays as well as strings can be properly parsed.
The same treatment is given to the similar `post_name__in` and
`post_parent__in` options of 'orderby', so that most query generation for
orderby clauses happens in the same place, instead of in special cases.
A slight change in the resulting SQL (related to the whitespace around
parentheses and commas) necessitates a change to an existing REST API test
that does a string comparison against the SQL query.
Props mgibbs189, kelvink.
Fixes #38034.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38034#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list