apply_filters( “{$adjacent}_post_link”, string $output, string $format, string $link, WP_Post|string $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

$outputstring
The adjacent post link.
$formatstring
Link anchor format.
$linkstring
Link permalink format.
$postWP_Post|string
The adjacent post. Empty string if no corresponding post exists.
$adjacentstring
Whether the post is previous or next.

Source

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

Changelog

VersionDescription
4.2.0Added the $adjacent parameter.
2.6.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.