posts_nav_link() WordPress Function

The posts_nav_link() function is used to display links to the next and previous posts in a WordPress loop. This function is used when you want to display links to the next and previous posts on a single post or page.

posts_nav_link( string $sep = '', string $prelabel = '', string $nxtlabel = '' ) #

Displays the post pages link navigation for previous and next pages.


Parameters

$sep

(string)(Optional) Separator for posts navigation links.

Default value: ''

$prelabel

(string)(Optional) Label for previous pages.

Default value: ''

$nxtlabel

(string)(Optional)Label for next pages.

Default value: ''


Top ↑

More Information

For displaying next and previous pages of posts see next_posts_link() and previous_posts_link().

For displaying next and previous post navigation on individual posts, see next_post_link() and previous_post_link().

Note: since weblog posts are traditionally listed in reverse chronological order (with most recent posts at the top), there is some ambiguity in the definition of “next page”. WordPress defines “next page” as the “next page toward the past“.


Top ↑

Source

File: wp-includes/link-template.php

function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) {
	$args = array_filter( compact( 'sep', 'prelabel', 'nxtlabel' ) );
	echo get_posts_nav_link( $args );
}


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