Count posts in custom taxonomy

Use an instance of WP_Query to query the database.
http://codex.wordpress.org/Class_Reference/WP_Query

To query database for custom taxonomies use,

$query = new WP_Query( array( 'people' => 'bob' ) );

For more details on available options see: Taxonomy Parameters
http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

Retrieve published posts using

'post_status' => 'publish'

Use found_posts to retrive the number of posts

$count = $query->found_posts;

Leave a Comment