WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to show the number of posts on the category page. How is it possible? I tried to find a solution but no luck..

Thank you!

share|improve this question

If you are on a category archive you don't need to query all the posts of the category like Christopher Ross suggested and you can't use get_the_category() like Max Yudin suggested unless you are already in the loop.

What you can do is simply get the current category object using get_queried_object() which will hold the post count, ex:

$category = get_queried_object();
echo $category->count;
share|improve this answer
$category = get_the_category(); 
echo $category[0]->category_count;

See /Function_Reference/get_the_category

Next time when you think about categories just have a close look at category functions in Codex.

share|improve this answer
get_the_category() is only available when you are in the loop – Bainternet Feb 7 '13 at 21:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.