Post count in a category

$chosen_id = 5;
$thisCat = get_category($chosen_id);
echo $thisCat->count;


You must be logged in to post a comment.

  1. Thank you for this WordPress snippets. I have a lot of collection of WordPress snippets. any one can see My WordPress code snippets

  2. It doesn't show the total number of posts under parent category...
    just the ones straight under that category...

    any solution?


  3. Thank you so much for posting this code. I've been searching an querying others for days looking for code that shows the count total only so I could insert it next to text I'd formatted myself. Found code that showed the total without the category name, but it still displayed the title, 'Category'. And on... But finally, I found your page. Bless you for opening up a window of coding opportunity to me I almost thought was nailed shut.