Title: posts_nav_link
Published: April 25, 2014
Last modified: February 24, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#parameters)
 * [More Information](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#wp--skip-link--target)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#parameters)󠁿

 `$sep`stringoptional

Separator for posts navigation links. Default empty.

`$prelabel`stringoptional

Label for previous pages. Default empty.

`$nxtlabel`stringoptional

Optional Label for next pages. Default empty.

## 󠀁[More Information](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#more-information)󠁿

For displaying next and previous pages of posts see [next_posts_link()](https://developer.wordpress.org/reference/functions/next_posts_link/)
and [previous_posts_link()](https://codex.wordpress.org/Function_Reference/previous_posts_link).

For displaying next and previous post navigation on individual posts, see [next_post_link()](https://developer.wordpress.org/reference/functions/next_post_link/)
and [previous_post_link()](https://developer.wordpress.org/reference/functions/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_“.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/link-template.php#L2765)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/link-template.php#L2765-L2768)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#related)󠁿

| Uses | Description | 
| [get_posts_nav_link()](https://developer.wordpress.org/reference/functions/get_posts_nav_link/)`wp-includes/link-template.php` |

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

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#changelog)󠁿

| Version | Description | 
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 6 content](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#comment-content-1177)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/posts_nav_link/#comment-1177)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%23comment-1177)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%23comment-1177)
 4.  **Using Images**
 5.      ```php
         <?php posts_nav_link( ' ', '<img src="' . esc_attr( get_bloginfo( 'stylesheet_directory' ) . '/images/prev.jpg . ')'" />', '<img src="' . esc_attr( get_bloginfo( 'stylesheet_directory' ) . '/images/next.jpg . ')'" />' ); ?>
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%3Freplytocom%3D1177%23feedback-editor-1177)
 7.   [Skip to note 7 content](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#comment-content-1175)
 8.    [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/posts_nav_link/#comment-1175)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%23comment-1175)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%23comment-1175)
 10. **Default Usage**
 11. By default, the [posts_nav_link()](https://developer.wordpress.org/reference/functions/posts_nav_link/)
     look like this:
 12. « Previous Page — Next Page »
 13.     ```php
         <?php posts_nav_link(); ?>
         ```
     
 14.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%3Freplytocom%3D1175%23feedback-editor-1175)
 15.  [Skip to note 8 content](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#comment-content-1176)
 16.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/posts_nav_link/#comment-1176)
 17. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%23comment-1176)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%23comment-1176)
 18. **In Centered DIV**
 19. Displays previous and next page links (“previous page · next page”) centered on
     the page.
 20.     ```php
         <div style="text-align:center;">
         	<?php posts_nav_link( ' · ', 'previous page', 'next page' ); ?>
         </div>
         ```
     
 21.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%3Freplytocom%3D1176%23feedback-editor-1176)
 22.  [Skip to note 9 content](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#comment-content-1178)
 23.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/posts_nav_link/#comment-1178)
 24. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%23comment-1178)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%23comment-1178)
 25. **Kubrick Theme Format**
 26. The Kubrick theme format for posts navigation, could be formatted this way. However,
     using [posts_nav_link()](https://developer.wordpress.org/reference/functions/posts_nav_link/)
     in this way will result in unintended behavior, such as double stacked next and
     previous links that link to the incorrect sections.
 27. The Kubrick Theme actually uses [next_posts_link()](https://developer.wordpress.org/reference/functions/next_posts_link/)
     and [previous_posts_link()](https://developer.wordpress.org/reference/functions/previous_posts_link/).
 28. This is poor code and should not be used:
 29.     ```php
         <div class="navigation">
         <div class="alignleft"><?php posts_nav_link( '', '', '&laquo; Previous Entries' ); ?></div>
         <div class="alignright"><?php posts_nav_link( '', 'Next Entries &raquo;', '' ); ?></div>
         </div>
         ```
     
 30. This is better code:
 31.     ```php
         <div class="navigation">
         <div class="alignleft"><?php previous_posts_link( '&laquo; Previous Entries' ); ?></div>
         <div class="alignright"><?php next_posts_link( 'Next Entries &raquo;', '' ); ?></div>
         </div>
         ```
     
 32.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%3Freplytocom%3D1178%23feedback-editor-1178)
 33.  [Skip to note 10 content](https://developer.wordpress.org/reference/functions/posts_nav_link/?output_format=md#comment-content-1179)
 34.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/posts_nav_link/#comment-1179)
 35. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%23comment-1179)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%23comment-1179)
 36. You can change the text in each of the links and in the text in between the links.
 37. `You can go back to the previous page or you can go forward to the next page.`
 38.     ```php
         <p><?php posts_nav_link( ' or ', 'You can go back to the previous page', 'you can go forward to the next page' ); ?>.</p>
         ```
     
 39.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F%3Freplytocom%3D1179%23feedback-editor-1179)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fposts_nav_link%2F)
before being able to contribute a note or feedback.