First of all, I know it's a duplicate, but none of the older answers were helpful.
I'm searching in posts through
post_meta. Here's my code, which currently returns nothing.
$args = array( 'numberposts' => -1, 'post_type' => 'post', 'meta_query' => array( array( 'key' => 'system_power_supply', 'value' => array('single', 'redundant'), 'compare' => 'IN', ) ) ); $query = new WP_Query($args); echo $query->found_posts;
If I remove
meta_query it works. I'm sure of these things:
- There's no spelling mistake in the
- post type is
- There is a post with the value 'single' in 'system_power_supply'. However, post fields are generated by Advanced Custom Fields.