How to determine if a category is empty?

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

Related posts

Leave a Reply

1 comment

  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.