wppaste
WordPress

get_next_post( bool $in_same_term = false, int[]|string $excluded_terms = '', string $taxonomy = 'category' ): WP_Post|null|string

Since
1.5.0
Source
wp-includes/link-template.php:1807
Retrieves the next post that is adjacent to the current post.

Parameters

$in_same_termbooloptional
Whether post should be in the same taxonomy term. Default false.Default: false
$excluded_termsint[]|stringoptional
Array or comma-separated list of excluded term IDs. Default empty.Default: ''
$taxonomystringoptional
Taxonomy, if $in_same_term is true. Default 'category'.Default: 'category'

Return

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

Uses · 1

Used by · 2

Source

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

History

Introduced in 1.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/link-template.php, 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.