This question already has an answer here:
In my WP_Query I'd like to have a tax query and a meta query, but I want the results to include results that match the tax query AND/OR the meta query - if I do it like the below, then it only returns posts that match both the tax qury and meta query.
$args = array( 'post_type' => 'product', 'posts_per_page' => 12, 'tax_query' => array( array( 'taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => $product_cats_to_show, 'include_children' => true ), ), 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'color', 'value' => 'red', 'compare' => '!=', ) ) );
The above returns products that have a
red AND products of those categories. I want it to be AND/OR, not just AND. I.E. I want the query to return all products with
red and all products that are in the categories specified in the tax query.
Is this possible using WP_Query args? Or do I need to build a custom query?