I believe what you are looking for is the relation
parameter in meta_query
. I’m assuming you are using the WP_Query
class to make the call given your syntax in the example. You might want to ensure that no other plugins are forcing the relation parameter to be “OR” instead of the default “AND” by hooking into pre_get_posts
.
$meta_query_AND = array(
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'featured',
'value' => 'yes',
'compare' => 'NOT NULL',
),
array(
'key' => 'type',
'value' => 'event',
'compare' => 'NOT NULL',
)
)
);
$test_query = new WP_Query( $meta_query_AND );
The first step would be to evaluate the meta_query
=> relation
value in your wp_query
result.