I have 2 post types: lets say products
and product_variations
. I’d like to be able to modify the query via pre_get_posts
to get all product with meta_keys "_visible" = "true"
and "_available" = "true"
AND all product_variations with meta_key "_featured" = "true"
.
The product_variations don’t have the meta_keys "_visible"/"_available"
and vice versa, so a straight up AND
meta_query returns no results. OR
relation isn’t quite right either as two fields are AND
related for one post type then OR
related to the other post type.
To make that slightly more visual because I just realized how complex it is to write out:
**product**
_visible = true
_available = true
**product_variation**
_featured = true
Is this possible via query args?
Is this possible via posts_where
?
Do I need to run a separate query and then somehow merge the results?