Skip Navigation

AND always used with multiple Views query filters, even if OR is specified

Open

Topic Tags: Views, Views plugin

Symptoms

When multiple search filters or query filters are added to a View, the legacy editor for Views allows you to specify whether the condition for matching multiple filters should use AND or OR. (The option isn’t currently available in the block editor.)

Selecting OR doesn’t work, the generated query always applies AND as the condition for multiple filters.

Workaround

It would be possible to modify the query generated by Views to force the OR comparison using the API filter wpv_filter_query, with a suitably high priority (e.g. 101).

See https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

Leave
a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>