next_posts( int $max_page, bool $display = true ): string|void

In this article

Displays or retrieves the next posts page link.

Parameters

$max_pageintoptional
Max pages. Default 0.
$displaybooloptional
Whether to echo the link.

Default:true

Return

string|void The link URL for next posts page if $display = false.

Source

function next_posts( $max_page = 0, $display = true ) {
	$link   = get_next_posts_page_link( $max_page );
	$output = $link ? esc_url( $link ) : '';

	if ( $display ) {
		echo $output;
	} else {
		return $output;
	}
}

Changelog

VersionDescription
0.71Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.