WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get previous posts link

Description

Return the previous posts pages link. Param string $label Optional. Previous page link text.

Usage

 <?php get_previous_posts_link$label ); ?> 

Parameters

$label
(string) (Optional) Previous page link text.
Default: '« Previous Page'

Return

"" (string) 
Previous page link.

Examples

Default Usage

<?php $prev get_previous_posts_link();
echo 
$prev;
?>

Removing Trailing Slashes from Prev & Next links

If you are using no-end-trailing slashes for your URLs. You may add following filter in your functions file to remove trailing slashes from generated links from get_previous_posts_links() function.
<?php 
add_filter
'get_pagenum_link''user_trailingslashit' );
?>

Change Log

Since: 2.7

Source File

get_previous_posts_link() is located in wp-includes/link-template.php.

Related

See also index of Function Reference and index of Template Tags.