I am using this query for my loop and it is working except when
meta_value is empty. In this case it returns empty result. Instead I want to get all results when
meta_value is empty.
Here is my code
$query = new WP_Query( array( 'post_type' => 'my_post_type', 'meta_query' => array( array( 'key' => 'state', 'value' => 'Alabama', ), array( 'key' => 'country', 'value' => $region, ), ), ) );
I want to get all results in state Alabama when variable region will be empty. Any suggestion about this will be much appreciated.