adjacent_posts_rel_link_wp_head()
云策文档标注
概述
adjacent_posts_rel_link_wp_head() 是一个 WordPress 函数,用于在单篇文章页面显示相邻文章的关联链接。它通常通过 'wp_head' 动作钩子调用,不应直接在插件或主题模板中调用。
关键要点
- 函数功能:显示当前文章相邻文章的关联链接,适用于单篇文章页面。
- 调用方式:应附加到 'wp_head' 等动作钩子,避免直接调用。
- 内部逻辑:使用 is_single() 和 is_attachment() 检查条件,并调用 adjacent_posts_rel_link() 输出链接。
- 版本历史:从 WordPress 3.0.0 引入,5.6.0 起在核心中不再使用。
注意事项
此函数已从 WordPress 核心中移除,建议开发者使用替代方法或检查最新文档。
原文内容
Displays relational links for the posts adjacent to the current post for single post pages.
Description
This is meant to be attached to actions like ‘wp_head’. Do not call this directly in plugins or theme templates.
See also
Source
function adjacent_posts_rel_link_wp_head() {
if ( ! is_single() || is_attachment() ) {
return;
}
adjacent_posts_rel_link();
}