W3cubDocs

/WordPress

the_post_navigation( array $args = array() )

Displays the navigation to next/previous post, when applicable.

Parameters

$argsarrayoptional
See get_the_post_navigation() for available arguments.
More Arguments from get_the_post_navigation( … $args )Default post navigation arguments.
  • prev_text string
    Anchor text to display in the previous post link.
    Default '%title'.
  • next_text string
    Anchor text to display in the next post link.
    Default '%title'.
  • in_same_term bool
    Whether link should be in the same taxonomy term.
    Default false.
  • excluded_terms int[]|string
    Array or comma-separated list of excluded term IDs.
  • taxonomy string
    Taxonomy, if $in_same_term is true. Default 'category'.
  • screen_reader_text string
    Screen reader text for the nav element.
    Default ‘Post navigation’.
  • aria_label string
    ARIA label text for the nav element. Default 'Posts'.
  • class string
    Custom class for the nav element. Default 'post-navigation'.

Default:array()

Source

function the_post_navigation( $args = array() ) {
	echo get_the_post_navigation( $args );
}

Changelog

Version Description
4.1.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/the_post_navigation