Title: {$adjacent}_post_link
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( “{$adjacent}_post_link”, string $output, string $format, string $link, WP_Post|string $post, string $adjacent )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/adjacent_post_link/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/adjacent_post_link/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/adjacent_post_link/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/adjacent_post_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/adjacent_post_link/?output_format=md#changelog)

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

Filters the adjacent post link.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/adjacent_post_link/?output_format=md#description)󠁿

The dynamic portion of the hook name, `$adjacent`, refers to the type of adjacency,‘
next’ or ‘previous’.

Possible hook names include:

 * `next_post_link`
 * `previous_post_link`

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

 `$output`string

The adjacent post link.

`$format`string

Link anchor format.

`$link`string

Link permalink format.

`$post`[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)|string

The adjacent post. Empty string if no corresponding post exists.

`$adjacent`string

Whether the post is previous or next.

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

    ```php
    return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent );
    ```

[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.0/src/wp-includes/link-template.php#L2396)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/link-template.php#L2396-L2396)

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

| Used by | 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.

  |

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

| Version | Description | 
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Added the `$adjacent` parameter. | 
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |

## User Contributed Notes

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