next_posts_link( string $label = null, int $max_page )
Displays the next posts page link.
Description Description
Parameters Parameters
- $label
-
(string) (Optional) Content for link text.
Default value: null
- $max_page
-
(int) (Optional) Max pages. Default 0.
Source Source
File: wp-includes/link-template.php
function next_posts_link( $label = null, $max_page = 0 ) { echo get_next_posts_link( $label, $max_page ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
0.71 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Basic Example
Check if next link exists
Usage when querying the loop with WP_Query
Add the $max_pages parameter to the next_posts_link() function when querying the loop with WP_Query. To get the total amount of pages you can use the ‘max_num_pages’ property of the custom WP_Query object.
Expand full source codeCollapse full source code