get_next_post() – Retrieves the next post that is adjacent to the current post.

Description

Retrieves the next post that is adjacent to the current post.

Usage

$WP_Post|null|string = get_next_post( $in_same_term, $excluded_terms, $taxonomy );

Parameters

$in_same_term
( bool ) optional – Optional. Whether post should be in a same taxonomy term. Default false.
$excluded_terms
( int[]|string ) optional – Optional. Array or comma-separated list of excluded term IDs. Default empty.
$taxonomy
( string ) optional default: category – Optional. Taxonomy, if $in_same_term is true. Default 'category'.

Returns

WP_Post|null|string Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.

Source

File name: wordpress/wp-includes/link-template.php
Lines:

1 to 3 of 3
function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
  return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy );
}
 

 View on GitHub View on Trac

Called by

    Invoked by

      Calls

      Call hooks

      API Letters: ,,