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

A client of mine reviews products on his site, and wants to display the review criteria and score on the last page of each posts. Typically, there are 3-5 pages per post, and I'm looking for a way to check if we're on the last page.

‹!--nextpage--› is used in the post to divide it into pages, and wp_link_pages on the front-end to display pagination links.

I've been able to find ways of checking if we're on page one, or not on page one, or on a specific page. But nothing for checking if we're on the very last page.

share|improve this question
up vote 5 down vote accepted

You can find this info in the global vars $multipage, $numpages, and $page

global $multipage, $numpages, $page;
if( $multipage && $page == $numpages )
    echo 'last page';
share|improve this answer
That did it, thank you! – Matt Brett Nov 7 '12 at 16:56
thank you. great help. – Eez Nov 22 '15 at 15:23

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.