钩子文档

edit_comment_link

💡 云策文档标注

概述

edit_comment_link 是一个 WordPress 过滤器,用于修改评论编辑链接的锚标签。它允许开发者自定义链接的 HTML 结构和内容。

关键要点

  • 过滤器名称:edit_comment_link
  • 参数:$link(锚标签字符串)、$comment_id(评论 ID 字符串)、$text(锚文本字符串)
  • 用途:在显示评论编辑链接时,通过 apply_filters 调用,可修改链接的 HTML 输出
  • 相关函数:edit_comment_link() 用于显示格式化后的编辑链接

代码示例

echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after;

📄 原文内容

Filters the comment edit link anchor tag.

Parameters

$linkstring
Anchor tag for the edit link.
$comment_idstring
Comment ID as a numeric string.
$textstring
Anchor text.

Source

echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after;

Changelog

Version Description
2.3.0 Introduced.