get_comment_type
云策文档标注
概述
本文档介绍 WordPress 中的 get_comment_type 过滤器,用于过滤返回的评论类型。该过滤器允许开发者修改评论类型,如 'comment'、'pingback' 或 'trackback'。
关键要点
- 过滤器名称:get_comment_type
- 参数:$comment_type(评论类型字符串)、$comment_id(评论 ID 字符串)、$comment(WP_Comment 对象)
- 用途:在 get_comment_type() 函数中应用,用于自定义评论类型的返回值
- 版本历史:从 WordPress 1.5.0 引入,4.1.0 版本添加了 $comment_id 和 $comment 参数
原文内容
Filters the returned comment type.
Parameters
$comment_typestring-
The type of comment, such as
'comment','pingback', or'trackback'. $comment_idstring-
The comment ID as a numeric string.
$commentWP_Comment-
The comment object.
Source
return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment );