For multi-page posts:
- The
$page
global variable returns the current page of a multi-page post. - The
$numpages
global variable returns the total number of pages in a multi-page post.
For paginated archive index pages:
- The
$paged
global variable returns the current page number of a paginated archive index.
To use any of these variables, simply globalize them first:
global $page;
echo 'The current page number of this post is ' . $page . '.';
Related Posts:
- Does it make sense to assign functions like is_paged() to a variable rather than using it multiple times?
- How to determine if I’m on the first page of pagination?
- How can I create a category landing page followed by pages of posts?
- get_query_var( ‘paged’ ) not working outside of homepage
- What is the difference between $paged and $page?
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- Get the number of posts from the current page results
- Why does pagination always break when used on any form of a home page?
- Change page /2 to /transcript with a Rewrite
- How can I display 7 posts on the home page, but 9 posts on the subsequent pages?
- Custom Permalinks Break Search Pagination
- ‘paged’ in wp_query doesn’t work
- Using next/previous_posts_link with customised search
- Last comment page first with full number of comments?
- Customized first post techniques
- $wp_query->current_post restarts from zero on paged pages
- Merged two WP_Queries, posts per page and pagination not working
- Pagination not working on custom query
- Paginate_links won’t create the right links on a taxonomy filtered custom post type archive
- Customising rewrite rules for CPT single post URL to work as paged URL
- Using $paged redirects /page/2 to page 1
- Custom posts per page does not work with pagination
- Pagination on category page with custom post types
- paged > max_num_pages won’t throw 404
- $paged always 0 on plugin’s custom page
- Masonry, WP_Query & paged – first page repeating, second page not loading
- Shortcode not working with post counter
- Querying posts only if the current page is not paged?
- using is_paged for hiding image on posts
- Cannot go back to the first paginated page using pagination links
- Custom WP_Query always respond with 200 status even when no entry
- “paged” in WP_Query returns 0 posts
- Archive template combined with post slider and regular posts
- Differnt page template for page 2 of blog feed
- Get paged outside of loop?
- Pagination on template page for custom query redirecting to index.php
- Determine if, within a post, you are on page 2 or greater – WordPress documentation circular
- How to list custom post types on a custom post type page?
- Pagination, query more pages at once
- Get a link to paged() part?
- WP_Query orderby random do not repeat infinite scroll – one loop
- filter posts by meta key with pagination
- Having a variable based on $post_count increase when i move to the next page of results
- Difference between $numpages & $max_page on archive pages
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- Disable pagination in posts and pages
- div show on home page only not in paged
- Rewrite Rules, Query Vars and Pagination
- Pagination diplays always 2 pages
- the paged param is allways 0
- Print all content of a paged post
- Next / previous posts link doesn’t show up with Posts 2 Posts
- Query counting excluded category on paged loop
- List of filtered Events is breaking paging?
- Why won’t my paged wp_query work? [duplicate]
- send user to first page of results when reposting to page?
- WordPress loop problem: Multiple loops, index.php and is_paged causing duplicate posts on next page
- Pagination not working in secondary query
- paged query leads to 404? [duplicate]
- Insert image between X number of posts but on specific paginated pages?
- Remove /Page/ from slug when we’re visiting 2nd and other inner pages of the blog page
- Paginate_Links page 2 doesn’t work