I'm trying to count results for a given query, but I don't actually need the posts so I'm trying to figure out if there's a way to count posts without querying them. Something similar to https://codex.wordpress.org/Function_Reference/wp_count_posts
I'm counting posts by meta key/value so
wp_count_posts() won't work.
Here's what I'm currently doing:
$query = new WP_Query(array( "post_type" => 'my-post-type', "posts_per_page" => 0, "meta_key" => "my_custom_key", "meta_value" => "some_value", )); echo $query->found_posts;