Check if on last page of paginated post using wp_link_pages

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.

Read More

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.

Related posts

Leave a Reply

1 comment

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

    global $multipage, $numpages, $page;
    if( $multipage && $page == $numpages )
        echo 'last page';