comment_reply_link_args
云策文档标注
概述
comment_reply_link_args 是一个 WordPress 过滤器,用于修改评论回复链接的参数。它允许开发者自定义回复链接的行为和外观,例如文本、深度和 HTML 结构。
关键要点
- 过滤器名称:comment_reply_link_args,用于过滤评论回复链接的参数数组。
- 参数:接受 $args(参数数组)、$comment(WP_Comment 对象)和 $post(WP_Post 对象)作为参数。
- 用途:覆盖默认参数,如回复文本、深度限制、前后 HTML 等,以定制评论回复功能。
代码示例
$args = apply_filters( 'comment_reply_link_args', $args, $comment, $post );注意事项
- 参数 $args 包含多个选项,如 add_below、reply_text、max_depth 等,需参考 get_comment_reply_link() 函数文档。
- 使用时应确保参数值符合 WordPress 核心规范,避免破坏评论功能。
原文内容
Filters the comment reply link arguments.
Parameters
$argsarray-
Comment reply link arguments. See get_comment_reply_link() for more information on accepted arguments.
More Arguments from get_comment_reply_link( … $args )
Override default arguments.
add_belowstringThe first part of the selector used to identify the comment to respond below.
The resulting value is passed as the first parameter to addComment.moveForm(), concatenated as $add_below-$comment->comment_ID. Default'comment'.respond_idstringThe selector identifying the responding comment. Passed as the third parameter to addComment.moveForm(), and appended to the link URL as a hash value.
Default'respond'.reply_textstringThe visible text of the Reply link. Default'Reply'.reply_to_textstringThe accessible name of the Reply link, using%sas a placeholder for the comment author’s name. Default ‘Reply to %s’.
Should start with the visiblereply_textvalue.show_reply_to_textboolWhether to usereply_to_textas visible link text. Default false.login_textstringThe text of the link to reply if logged out. Default ‘Log in to Reply’.max_depthintThe max depth of the comment tree. Default 0.depthintThe depth of the new comment. Must be greater than 0 and less than the value of the'thread_comments_depth'option set in Settings > Discussion. Default 0.beforestringThe text or HTML to add before the reply link.afterstringThe text or HTML to add after the reply link.
$commentWP_Comment-
The object of the comment being replied to.
$postWP_Post-
The WP_Post object.
Source
$args = apply_filters( 'comment_reply_link_args', $args, $comment, $post );
Changelog
| Version | Description |
|---|---|
| 4.1.0 | Introduced. |