钩子文档

{$adjacent}_post_rel_link

💡 云策文档标注

概述

此文档介绍 {$adjacent}_post_rel_link 过滤器钩子,用于过滤相邻文章的关系链接。钩子名称中的动态部分 $adjacent 指定链接类型为“next”或“previous”。

关键要点

  • 钩子名称基于 $adjacent 参数动态生成,例如 next_post_rel_link 和 previous_post_rel_link。
  • 参数 $link 为字符串类型,表示要过滤的关系链接。
  • 此钩子在 get_adjacent_post_rel_link() 函数中被调用,用于检索相邻文章链接。
  • 自 WordPress 2.8.0 版本引入。

📄 原文内容

Filters the adjacent post relational link.

Description

The dynamic portion of the hook name, $adjacent, refers to the type of adjacency, ‘next’ or ‘previous’.

Possible hook names include:

  • next_post_rel_link
  • previous_post_rel_link

Parameters

$linkstring
The relational link.

Source

return apply_filters( "{$adjacent}_post_rel_link", $link );

Changelog

Version Description
2.8.0 Introduced.