get_comment_ID
云策文档标注
概述
本文档介绍 WordPress 中的 get_comment_ID 过滤器,用于过滤返回的评论 ID。该过滤器允许开发者在获取评论 ID 时进行自定义修改。
关键要点
- 过滤器名称:get_comment_ID
- 参数:$comment_id(当前评论 ID 的字符串)和 $comment(评论对象)
- 用途:在 get_comment_ID() 函数中应用,用于修改或过滤评论 ID
- 版本历史:WordPress 4.1.0 添加了 $comment 参数,1.5.0 版本引入
代码示例
return apply_filters( 'get_comment_ID', $comment_id, $comment );
原文内容
Filters the returned comment ID.
Parameters
$comment_idstring-
The current comment ID as a numeric string.
$commentWP_Comment-
The comment object.
Source
return apply_filters( 'get_comment_ID', $comment_id, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase