pre_comment_author_email
云策文档标注
概述
pre_comment_author_email 是一个 WordPress 过滤器钩子,用于在设置评论作者邮箱 cookie 前过滤其值。它在 wp_filter_comment() 函数中被调用,处理评论数据时应用。
关键要点
- 这是一个过滤器钩子,允许开发者修改评论作者邮箱 cookie 的值。
- 钩子在 wp_filter_comment() 函数中执行,传入参数为评论作者邮箱 cookie 的字符串。
- 相关函数包括 wp_filter_comment() 和 sanitize_comment_cookies(),用于评论数据的过滤和清理。
- 自 WordPress 1.5.0 版本引入,是一个长期可用的核心钩子。
代码示例
$comment_author_email = apply_filters( 'pre_comment_author_email', $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] );
原文内容
Filters the comment author’s email cookie before it is set.
Description
When this filter hook is evaluated in wp_filter_comment() , the comment author’s email string is passed.
Parameters
$author_email_cookiestring-
The comment author email cookie.
Source
$comment_author_email = apply_filters( 'pre_comment_author_email', $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] );
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |