apply_filters( "{$adjacent}_post_link", string $output, string $format, string $link, WP_Post|string $post, string $adjacent )
- Since
- 2.6.0, 4.2.0
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_linkprevious_post_link
Compatibility
- WordPress
- since 4.2.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
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.
Where this hook fires · 1
wp-includes/link-template.php:2396get_adjacent_post_link()
Source code
* @param string $output The adjacent post link. * @param string $format Link anchor format. * @param string $link Link permalink format. * @param WP_Post|string $post The adjacent post. Empty string if no corresponding post exists. * @param string $adjacent Whether the post is previous or next. */ return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent );} /** * Displays the adjacent post link. * * Can be either next post link or previous.Changelog
Introduced in 2.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.2.0
Added the
$adjacent parameter.from the docblock2.6.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.