Opened 7 years ago
Last modified 6 years ago
#42284 new defect (bug)
Stop invalid query generation in WP_Site_Query
Reported by: | spacedmonkey | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.6 |
Component: | Networks and Sites | Keywords: | |
Focuses: | multisite | Cc: |
Description
In WP_Site_Query, developers have the ability to query by a single value or by multiple using a __in
param. An example of which is which is domain
and domain__in
. Take for example the following query.
`
get_sites(=> 'test.local', 'domain__in' => ['lebowski.local', 'start.test.local'?]);
`
This query will only results for test.local, completely ignoring the domain__in
. This is because of the query it generates. That looks like this
domain = 'test.local' AND domain IN ('lebowski.local', 'start.test.local')
Improved error checking must be implemented on this code to stop invalid queries.
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
42284.diff
This is a first patch. This is not finished as it does have tests. Uploaded as a talking point. My work around is move all single values to the multi values. This way, all queries are doing a IN search. This should have any effect on performance, but will make better results be returned.
Also notice the placement of the tidy of query, after filter has been run, maintaining backwards compatibility.