钩子文档

comment_excerpt

💡 云策文档标注

概述

comment_excerpt 是一个 WordPress 过滤器,用于修改评论摘要的显示内容。它允许开发者通过 Hook 来定制评论摘要的文本。

关键要点

  • 过滤器名称:comment_excerpt
  • 参数:$comment_excerpt(评论摘要文本字符串)和 $comment_id(评论 ID 字符串)
  • 应用场景:在 comment_excerpt() 函数中调用,用于显示当前评论的摘要
  • 版本历史:从 WordPress 1.2.0 引入,4.1.0 版本添加了 $comment_id 参数

代码示例

echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID );

📄 原文内容

Filters the comment excerpt for display.

Parameters

$comment_excerptstring
The comment excerpt text.
$comment_idstring
The comment ID as a numeric string.

Source

echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID );

Changelog

Version Description
4.1.0 The $comment_id parameter was added.
1.2.0 Introduced.