Count custom posts type and filter by tag
wp_count_posts is not affect your custom query. You can use found_posts to return the number of posts from the custom query. So try to change the code after your loop query as follows. Hope it helps. if ($loop->have_posts()) : $count_posts = $loop->found_posts; echo “<p>Total: $count_posts cars</p>”; else : echo “<p>No cars available.</p>”; endif; wp_reset_query();