Count the number of posts currently published in a specific category, tag or custom taxonomy.
function posts_in_term($catid, $taxonomy) { $term_query = get_term($catid, $taxonomy); return $term_query->count; }