Is there an existing function or call in which you can pass a category id to determine if the category has child posts?

1 Answer
1

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 Reply

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