previous_posts_link()WP 0.71

Outputs a link to the list of posts (pagination page). The link points to newer posts compared to the current ones. Navigation within the category.

This function is used on category (taxonomy) pages and on the main page.

To output a link to the next posts, use next_posts_link().

Since posts are usually sorted in reverse chronological order (new posts are added to the top), previous_posts_link() outputs a link to the page of new posts (aims for new posts), while next_posts_link() outputs a link to previous posts (i.e., aims for the beginning of the blog).

No Hooks.

Returns

null. Outputs the HTML code for the link.

Usage

<?php previous_posts_link( $label ); ?>
$label(string)
Text of the link
Default: '« Previous Page'

Examples

0

#1 Display a link to the previous block of posts on the category page:

<?php previous_posts_link(); ?>
0

#2 Change the link anchor to your own: "« move backward":

<?php previous_posts_link( '«  move backwards' ) ?>
0

#3 Check if previous link exists

$prev_link = get_previous_posts_link( '« Newer Entries' );
if( $prev_link ){
	echo $prev_link;
}

Changelog

Since 0.71 Introduced.

previous_posts_link() code WP 7.0

function previous_posts_link( $label = null ) {
	echo get_previous_posts_link( $label );
}