next_posts() WordPress Function
The next_posts() function is used to display the next set of posts, in relation to the current post. This function is useful for creating pagination on a WordPress site. The next_posts() function can be used in conjunction with the WordPress loop.
next_posts( int $max_page, bool $echo = true ) #
Displays or retrieves the next posts page link.
Parameters
- $max_page
(int)(Optional) Max pages. Default 0.
- $echo
(bool)(Optional) Whether to echo the link.
Default value: true
Return
(string|void) The link URL for next posts page if $echo = false
.
Source
File: wp-includes/link-template.php
function next_posts( $max_page = 0, $echo = true ) { $output = esc_url( get_next_posts_page_link( $max_page ) ); if ( $echo ) { echo $output; } else { return $output; } }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
0.71 | Introduced. |