apply_filters( "{$adjacent}_post_link", string $output, string $format, string $link, WP_Post $post, string $adjacent )

Filters the adjacent post link.

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

$output

(string) The adjacent post link.

$format

(string) Link anchor format.

$link

(string) Link permalink format.

$post

(WP_Post) The adjacent post.

$adjacent

(string) Whether the post is previous or next.

Source

File: wp-includes/link-template.php

View on Trac

Changelog

Version Description
4.2.0 Added the $adjacent parameter.
2.6.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/adjacent_post_link