pre_comment_author_name
云策文档标注
概述
pre_comment_author_name 是一个 WordPress 过滤器钩子,用于在设置评论作者名称 cookie 之前过滤其值。它主要在 wp_filter_comment() 函数中被调用,处理评论数据。
关键要点
- 这是一个过滤器钩子,用于修改评论作者名称 cookie 的字符串值。
- 在 wp_filter_comment() 函数中执行,传递评论作者名称字符串作为参数。
- 参数为 $author_cookiestring,代表评论作者名称 cookie。
- 源代码示例展示了如何应用此过滤器,从 $_COOKIE 中获取值。
- 相关函数包括 wp_filter_comment() 和 sanitize_comment_cookies(),用于评论数据的过滤和清理。
- 自 WordPress 1.5.0 版本引入。
原文内容
Filters the comment author’s name cookie before it is set.
Description
When this filter hook is evaluated in wp_filter_comment() , the comment author’s name string is passed.
Parameters
$author_cookiestring-
The comment author name cookie.
Source
$comment_author = apply_filters( 'pre_comment_author_name', $_COOKIE[ 'comment_author_' . COOKIEHASH ] );
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |