duplicate_comment_id
云策文档标注
概述
duplicate_comment_id 是一个 WordPress 过滤器,用于在创建新评论时,当检测到重复评论时,过滤其 ID。开发者可以通过此过滤器自定义重复评论的处理逻辑。
关键要点
- 过滤器名称:duplicate_comment_id
- 用途:过滤被识别为重复评论的 ID,允许开发者干预重复评论的判定
- 参数:$dupe_id(重复评论的 ID,整数类型)和 $commentdata(新评论的数据,数组类型)
- 返回值:返回空值可允许 WordPress 视为重复的评论通过
- 相关函数:在 wp_allow_comment() 中使用,用于验证评论是否允许创建
- 引入版本:WordPress 4.4.0
原文内容
Filters the ID, if any, of the duplicate comment found when creating a new comment.
Description
Return an empty value from this filter to allow what WP considers a duplicate comment.
Parameters
$dupe_idint-
ID of the comment identified as a duplicate.
$commentdataarray-
Data for the comment being created.
Source
$dupe_id = apply_filters( 'duplicate_comment_id', $dupe_id, $commentdata );
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |