Title: get_previous_post_link
Published: April 25, 2014
Last modified: August 20, 2026

---

# get_previous_post_link( string $format = ‘&laquo; %link’, string $link = ‘%title’, bool $in_same_term = false, int[]|string $excluded_terms = ”, string $taxonomy = ‘category’ ): string

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/get_previous_post_link/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_previous_post_link/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_previous_post_link/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_previous_post_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_previous_post_link/?output_format=md#changelog)

Retrieves the previous post link that is adjacent to the current post.

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

 `$format`stringoptional

Link anchor format. Default ‘« %link’.

Default:`'&laquo; %link'`

`$link`stringoptional

Link permalink format. Default `'%title'`.

Default:`'%title'`

`$in_same_term`booloptional

Whether link should be in the same taxonomy term.

Default:`false`

`$excluded_terms`int[]|stringoptional

Array or comma-separated list of excluded term IDs.

Default:`''`

`$taxonomy`stringoptional

Taxonomy, if `$in_same_term` is true. Default `'category'`.

Default:`'category'`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_previous_post_link/?output_format=md#return)󠁿

 string The link URL of the previous post in relation to the current post.

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

    ```php
    function get_previous_post_link( $format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
    	return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, true, $taxonomy );
    }
    ```

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

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

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

Retrieves the adjacent post link.

  |

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

Retrieves the navigation to next/previous post, when applicable.

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

Displays the previous post link that is adjacent to the current post.

  |

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

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

## User Contributed Notes

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