If I use
get_posts() like so I get a number of results with the value 1 for the
$posts = get_posts( array( 'post_type' => 'attachment', 'meta_key' => 'my_key', 'meta_value' => '1' ) ); //this has a bunch of results as expected print_r($posts);
However if I create a similar query with WP_Query I get an empty result array
$args = array( 'post_type' => 'attachment', 'meta_query' => array( array( 'key' => 'my_key', 'value' => '1', 'compare' => '=', 'type' => 'BINARY' ) ) ); $query = new WP_Query(); $results = $query->query($args); //this is empty print_r($results);
I have tried a few varieties of the meta_query array all with no luck. I am thinking that this might be a bug, but wanted to make sure I was not missing something first.