Using get_posts, I need to use a combination of OR & AND relations
Using WordPress v4.6, I set up arguments for get_posts()
based on price (2 conditions), sku, and categories like this:
[meta_query] = Array
(
[relation] = AND
[0] = Array
(
[key] = _price
[value] = Array
(
[0] = 0
[1] = 5
)
[type] = DECIMAL
[compare] = BETWEEN
)
[1] = Array
(
[key] = _price
[value] = Array
(
[0] = 50.01
[1] = 100
)
[type] = DECIMAL
[compare] = BETWEEN
)
[2] = Array
(
[key] = _sku
[value] = batte
[compare] = like
)
)
[tax_query] = Array
(
[0] = Array
(
[taxonomy] = product_cat
[field] = id
[terms] = Array
(
[0] = 26
[1] = 20
)
)
)
I set AND
relations, but actually I need OR
relations between 2 prices and AND
relations for the rest of the comparisons.
What is the correct syntax for this query?
Topic tax-query meta-query get-posts Wordpress
Category Web