adjacent_post_link()
Displays the adjacent post link.
Can be either next post link or previous.
No Hooks.
Return
null
. Nothing (null).
Usage
adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy );
- $format(string) (required)
- Link anchor format.
- $link(string) (required)
- Link permalink format.
- $in_same_term(true|false)
- Whether link should be in the same taxonomy term.
Default: false - $excluded_terms(int[]|string)
- Array or comma-separated list of excluded category IDs.
Default: '' - $previous(true|false)
- Whether to display link to previous or next post.
Default: true - $taxonomy(string)
- Taxonomy, if $in_same_term is true.
Default: 'category'
Changelog
Since 2.5.0 | Introduced. |
adjacent_post_link() adjacent post link code WP 6.6.2
function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy ); }