comment_text_rss()
云策文档标注
概述
comment_text_rss() 是一个 WordPress 函数,用于在 RSS 或 Atom 等订阅源中显示当前评论的内容。它通过调用 get_comment_text() 获取评论文本,并应用 comment_text_rss 过滤器进行自定义处理。
关键要点
- 函数功能:显示当前评论内容,专为订阅源设计。
- 内部流程:先调用 get_comment_text() 获取评论文本,再通过 apply_filters() 应用 comment_text_rss 过滤器。
- 过滤器:comment_text_rss 过滤器允许开发者修改评论内容在订阅源中的输出。
- 相关函数:与 get_comment_text() 和 apply_filters() 紧密相关。
代码示例
function comment_text_rss() {
$comment_text = get_comment_text();
/**
* Filters the current comment content for use in a feed.
*
* @since 1.5.0
*
* @param string $comment_text The content of the current comment.
*/
$comment_text = apply_filters( 'comment_text_rss', $comment_text );
echo $comment_text;
}
原文内容
Displays the current comment content for use in the feeds.
Source
function comment_text_rss() {
$comment_text = get_comment_text();
/**
* Filters the current comment content for use in a feed.
*
* @since 1.5.0
*
* @param string $comment_text The content of the current comment.
*/
$comment_text = apply_filters( 'comment_text_rss', $comment_text );
echo $comment_text;
}
Hooks
- apply_filters( ‘comment_text_rss’, string $comment_text )
-
Filters the current comment content for use in a feed.
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |