previous_posts() WordPress Function

The previous_posts() function is used to display a link to the previous set of posts, if available. This is typically used within a WordPress loop.

previous_posts( bool $echo = true ) #

Displays or retrieves the previous posts page link.


Parameters

$echo

(bool)(Optional) Whether to echo the link.

Default value: true


Top ↑

Return

(string|void) The previous posts page link if $echo = false.


Top ↑

Source

File: wp-includes/link-template.php

function previous_posts( $echo = true ) {
	$output = esc_url( get_previous_posts_page_link() );

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


Top ↑

Changelog

Changelog
VersionDescription
0.71Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More