钩子文档

post_comments_link

💡 云策文档标注

概述

post_comments_link 是一个 WordPress 过滤器,用于修改格式化后的文章评论链接 HTML。它允许开发者自定义评论链接的输出内容。

关键要点

  • 过滤器名称:post_comments_link
  • 参数:$post_reply_link(字符串,HTML 格式的评论链接)和 $post(整数或 WP_Post 对象,文章 ID 或文章对象)
  • 源位置:在 WordPress 核心代码中通过 apply_filters 调用
  • 相关函数:get_post_reply_link() 用于获取评论链接的 HTML 内容
  • 引入版本:WordPress 2.7.0

📄 原文内容

Filters the formatted post comments link HTML.

Parameters

$post_reply_linkstring
The HTML-formatted post comments link.
$postint|WP_Post
The post ID or WP_Post object.

Source

return apply_filters( 'post_comments_link', $post_reply_link, $post );

Changelog

Version Description
2.7.0 Introduced.