钩子文档

respond_link

💡 云策文档标注

概述

respond_link 过滤器用于在文章无评论时过滤响应链接,允许开发者自定义链接内容或行为。

关键要点

  • 过滤器名称:respond_link
  • 参数:$respond_link(默认响应链接字符串)和 $post_id(文章ID)
  • 应用场景:当文章没有评论时,通过 apply_filters 调用此过滤器
  • 相关函数:comments_popup_link() 用于显示当前文章ID的评论链接
  • 引入版本:WordPress 4.4.0

代码示例

$comments_link = apply_filters( 'respond_link', $respond_link, $post_id );

📄 原文内容

Filters the respond link when a post has no comments.

Parameters

$respond_linkstring
The default response link.
$post_idint
The post ID.

Source

$comments_link = apply_filters( 'respond_link', $respond_link, $post_id );

Changelog

Version Description
4.4.0 Introduced.