previous_posts()WP 0.71

Displays or retrieves the previous posts page link.

No Hooks.

Returns

String|null. The previous posts page link if $display = false.

Usage

previous_posts( $display );
$display(true|false)
Whether to echo the link.
Default: true

Changelog

Since 0.71 Introduced.

previous_posts() code WP 7.0

function previous_posts( $display = true ) {
	$link   = get_previous_posts_page_link();
	$output = $link ? esc_url( $link ) : '';

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