I am experiencing some unexpected behavior. I have added a custom filed of "Rating" to my posts. I want to count up the number of posts with a certain rating:
$args = array( 'post_status' => 'publish', 'meta_query' => array( array( 'key' => 'rating', 'compare' => '=', 'value' => 7 ) ) ); $posts = new WP_Query($args); echo $posts->post_count;
When I set the value to 7, it echos the correct number of posts for that rating. But for some reason, if I set the value to 0, it echos the total number of published posts. What am I missing?