get_next_post()

最后更新于:2021-11-26 10:07:24

get_next_post( bool$in_same_term=false, int[]|string$excluded_terms=”, string$taxonomy=’category’)

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

参数

$in_same_term

(bool) (Optional) Whether post should be in a same taxonomy term.

Default value: false

$excluded_terms

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

Default value: ”

$taxonomy

(string) (Optional) Taxonomy, if $in_same_term is true.

Default value: ‘category’

响应

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

源文件

文件: gc-includes/link-template.php

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