[wp-trac] [WordPress Trac] #25245: Issue with SQL query generated by pre_get_posts
WordPress Trac
noreply at wordpress.org
Wed Oct 22 03:28:29 UTC 2014
#25245: Issue with SQL query generated by pre_get_posts
------------------------------------------+-------------------------
Reporter: greendemiurge | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: Query | Version: 3.6
Severity: normal | Resolution: maybelater
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+-------------------------
Changes (by boonebgorges):
* status: new => closed
* type: defect (bug) => enhancement
* resolution: => maybelater
* milestone: Future Release =>
Comment:
Thanks for the detailed report.
> However, looks like there's no way to change the AND before the meta
conditions using just meta_query.
Right. `meta_query` is acting properly here - the default relation is AND.
The larger issue is that all conditions in `WP_Query` - meta_query,
tax_query, post__in, author__in, date_query, post_status, post_type, etc
etc etc - are linked together using AND logic. There is simply no way,
using `WP_Query`, to say that you want posts that EITHER match a certain
search term OR a certain meta_query OR a certain post__in, much less more
complex groupings of these.
It would be neat to be able to do this, but it'd require a rewrite of much
of the class, as well as a good deal of up-front architectural work to
decide on a syntax, maintain backward compatibility, etc.
Maybe we should try to do this one day, but not today.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/25245#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list