检索与当前帖子相邻的下一篇文章。
原型
get_next_post( bool $in_same_term = false, array|string $excluded_terms = '', string $taxonomy = 'category' )
参数
$in_same_term
(bool)
(Optional)
帖子是否应该在同一个分类学术语中。
$excluded_terms
(array|string)
(Optional)
排除的术语ID的数组或逗号分隔列表。
$taxonomy
(string)
(Optional)
分类法,如果$ in_same_term为真。
返回值
(null|string|WP_Post)
如果成功则发布对象。如果未设置全局$ post,则为空。如果没有相应的帖子,则为空字符串
源文件
路径:wp-includes/link-template.php
<?php
...
function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_next_post/