<?php
// Your custom query
$query = new WP_Query($args);
// Check if there are posts found
if ($query->have_posts()) {
// Total post count found by the query
$post_count = $query->found_posts;
echo "Total Posts Found: " . $post_count;
} else {
echo "No posts found.";
}
// Don't forget to reset the query
wp_reset_postdata();
?>