diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 9244cff8a3..52080ea018 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -2337,13 +2337,17 @@ function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) { * Return navigation to next/previous post when applicable. * * @since 4.1.0 + * @since 4.4.0 Introduced the `in_same_term`, `excluded_terms`, and `taxonomy` arguments. * * @param array $args { * Optional. Default post navigation arguments. Default empty array. * - * @type string $prev_text Anchor text to display in the previous post link. Default `%title`. - * @type string $next_text Anchor text to display in the next post link. Default `%title`. - * @type string $screen_reader_text Screen reader text for nav element. Default 'Post navigation'. + * @type string $prev_text Anchor text to display in the previous post link. Default '%title'. + * @type string $next_text Anchor text to display in the next post link. Default '%title'. + * @type bool $in_same_term Whether link should be in a same taxonomy term. Default false. + * @type array|string $excluded_terms Array or comma-separated list of excluded term IDs. Default empty. + * @type string $taxonomy Taxonomy, if `$in_same_term` is true. Default 'category'. + * @type string $screen_reader_text Screen reader text for nav element. Default 'Post navigation'. * } * @return string Markup for post links. */ @@ -2351,12 +2355,29 @@ function get_the_post_navigation( $args = array() ) { $args = wp_parse_args( $args, array( 'prev_text' => '%title', 'next_text' => '%title', + 'in_same_term' => false, + 'excluded_terms' => '', + 'taxonomy' => 'category', 'screen_reader_text' => __( 'Post navigation' ), ) ); $navigation = ''; - $previous = get_previous_post_link( '', $args['prev_text'] ); - $next = get_next_post_link( '', $args['next_text'] ); + + $previous = get_previous_post_link( + '', + $args['prev_text'], + $args['in_same_term'], + $args['excluded_terms'], + $args['taxonomy'] + ); + + $next = get_next_post_link( + '', + $args['next_text'], + $args['in_same_term'], + $args['excluded_terms'], + $args['taxonomy'] + ); // Only add markup if there's somewhere to navigate to. if ( $previous || $next ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 3edff20577..2d4e273252 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34714'; +$wp_version = '4.4-alpha-34715'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.