get_adjacent_post()
get_adjacent_post( bool $in_same_term = false, array|string $excluded_terms = ”, bool $previous = true, string $taxonomy = ‘category’ )
检索相邻的帖子。
Retrieves the adjacent post.
说明(Description)
可以是下一篇文章,也可以是上一篇文章。
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$in_same_term | (bool) | 可选 | post是否应该在同一个分类术语中。 |
$excluded_terms | (array | string) | 可选 | 排除的术语ID的数组或逗号分隔列表。 |
$previous | (bool) | 可选 | 是否检索上一篇文章。默认为真 |
$taxonomy | (string) | 可选 | 分类法,如果$in_相同的术语是真的。 |
返回(Return)
(null|string|WP_Post)Post对象(null|string|WP_Post)。如果未设置全局$post,则为空。如果不存在对应的post,则为空string。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.5.0 | wp-includes/link-template.php:1702 | 4 | 21 |
笔记(Notes)
实例
get_adjacent_post() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_adjacent_post/