钩子文档

get_edit_comment_link

💡 云策文档标注

概述

本文档介绍了 WordPress 中的 get_edit_comment_link 过滤器,用于过滤评论编辑链接。该过滤器允许开发者自定义链接的生成方式,并支持传递评论 ID 和上下文参数。

关键要点

  • get_edit_comment_link 是一个过滤器,用于修改评论编辑链接。
  • 过滤器接收三个参数:$location(编辑链接字符串)、$comment_id(评论的唯一 ID)和 $context(上下文,默认为 'display')。
  • 在 WordPress 6.7.0 版本中,$comment_id 和 $context 参数被添加到过滤器中,增强了自定义能力。
  • 相关函数 get_edit_comment_link() 用于检索评论编辑链接,位于 wp-includes/link-template.php 文件中。

📄 原文内容

Filters the comment edit link.

Parameters

$locationstring
The edit link.
$comment_idint
Unique ID of the comment to generate an edit link.
$contextstring
Context to include HTML entities in link. Default 'display'.

Source

return apply_filters( 'get_edit_comment_link', $location, $comment_id, $context );

Changelog

Version Description
6.7.0 The $comment_id and $context parameters are now being passed to the filter.
2.3.0 Introduced.