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'm trying to find out whether there is more than one page of posts (I've set my posts per blog page to 5 in the reading settings) in a custom category template.

I would think the global query would have the total number of pages as a property but I can't find the call to it.

share|improve this question
up vote 9 down vote accepted
global $wp_query;
echo $wp_query->max_num_pages;

This shows the number of pages for the current query. If you want to determine the actual number of posts found by the current query, you may use $wp_query->found_posts

Source:- http://codex.wordpress.org/Class_Reference/WP_Query

share|improve this answer

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.