How to determine if a category is empty?

The get_term() function accepts a term id and a taxonomy slug. It returns an object that contains a “count” for that term.

$obj_term = get_term(123, 'your-taxonomy-slug');
echo $term->count;

I’m not aware of any utility function that just counts posts in a particular category.

Leave a Comment