WPDev.one
Core Function
View Source on Trac ↗

get_next_post()

get_next_post( mixed $in_same_term = false, mixed $excluded_terms = '', mixed $taxonomy = 'category' )

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

Parameters 2 required

Name / Type Description
bool

$in_same_term Optional. Whether post should be in the same taxonomy term. Default false.

Required
mixed

(int[] | string) $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.

Required
$taxonomy
string

Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.

Return Value

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

Function Information

Since Version
1.5.0
Source File
wp-includes/link-template.php
Advertisement