WP_Query not working as expected for attachments and custom meta_query
First, just pass your arguments to the constructor of WP_Query as this is both cleaner, and the way you’re supposed to do it according to the Codex documentation of the class. You should be constructing things like this: $my_key_query_args = array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘inherit’, ‘meta_query’ => array( array( ‘key’ => ‘my_key’, ‘value’ … Read more