the_feed_link
云策文档标注
概述
the_feed_link 是一个 WordPress 过滤器钩子,用于修改 feed 链接的锚标签输出。它允许开发者自定义 RSS2、Atom 或默认 feed 类型的链接显示。
关键要点
- 过滤器钩子名称:the_feed_link
- 参数:$link(完整的 feed 链接锚标签字符串)和 $feed(feed 类型,如 'rss2'、'atom' 或空字符串表示默认类型)
- 应用方式:通过 apply_filters 调用,通常用于主题或插件开发中调整 feed 链接的 HTML 输出
- 相关函数:the_feed_link() 用于显示 feed 类型的固定链接
代码示例
echo apply_filters( 'the_feed_link', $link, $feed );注意事项
- 该钩子自 WordPress 3.0.0 版本引入,使用时需确保兼容性。
- 参数 $feed 可能为空字符串,表示默认 feed 类型,开发时应处理此情况。
原文内容
Filters the feed link anchor tag.
Parameters
$linkstring-
The complete anchor tag for a feed link.
$feedstring-
The feed type. Possible values include
'rss2','atom', or an empty string for the default feed type.
Source
echo apply_filters( 'the_feed_link', $link, $feed );
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |