wp_blacklist_check
云策文档标注
概述
wp_blacklist_check 是一个 WordPress 已弃用的 Hook,在评论被检查是否包含不允许的字符或单词之前触发。自 WordPress 5.5.0 起,建议使用 wp_check_comment_disallowed_list 替代。
关键要点
- 这是一个已弃用的 Hook,用于在评论内容检查前执行自定义操作。
- 传递的参数包括评论作者、邮箱、URL、内容、IP 地址和用户代理。
- 自 WordPress 5.5.0 起,应使用 wp_check_comment_disallowed_list 替代,以支持更包容的代码实践。
代码示例
do_action_deprecated(
'wp_blacklist_check',
array( $author, $email, $url, $comment, $user_ip, $user_agent ),
'5.5.0',
'wp_check_comment_disallowed_list',
__( 'Please consider writing more inclusive code.' )
);注意事项
- 此 Hook 已弃用,新开发中应避免使用,转而使用 wp_check_comment_disallowed_list。
- 相关函数 wp_check_comment_disallowed_list() 位于 wp-includes/comment.php 中,用于检查评论是否包含不允许的字符或单词。
原文内容
Fires before the comment is tested for disallowed characters or words.
Parameters
$authorstring-
Comment author.
$emailstring-
Comment author’s email.
$urlstring-
Comment author’s URL.
$commentstring-
Comment content.
$user_ipstring-
Comment author’s IP address.
$user_agentstring-
Comment author’s browser user agent.
Source
do_action_deprecated(
'wp_blacklist_check',
array( $author, $email, $url, $comment, $user_ip, $user_agent ),
'5.5.0',
'wp_check_comment_disallowed_list',
__( 'Please consider writing more inclusive code.' )
);
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Deprecated. Use ‘wp_check_comment_disallowed_list’ instead. |
| 1.5.0 | Introduced. |