You can get get count of posts in a particular category by using below code. Before use please replace “CUSTOM_POST_TYPE” and “CUSTOM_TAXONOMY” with your post type and taxonomy.

$the_query = new WP_Query( array(
    'post_type' => 'CUSTOM_POST_TYPE',
    'tax_query' => array(
            'taxonomy' => 'CUSTOM_TAXONOMY',
            'field' => 'id',
            'terms' => TERM_ID
) );
$count = $the_query->found_posts;

Have any doubt please comment here.

Leave a Reply

Your email address will not be published. Required fields are marked *