pre_comment_author_url
云策文档标注
概述
pre_comment_author_url 是一个 WordPress 过滤器钩子,用于在设置评论作者 URL cookie 之前过滤其值。它在 wp_filter_comment() 函数中被调用,允许开发者修改或验证评论作者的 URL 字符串。
关键要点
- 过滤器钩子名称:pre_comment_author_url
- 主要用途:过滤评论作者 URL cookie 的值,在 wp_filter_comment() 中执行
- 参数:$author_url_cookie(字符串类型,表示评论作者 URL cookie)
- 相关函数:wp_filter_comment() 用于过滤和清理评论数据,sanitize_comment_cookies() 用于清理已发送给用户的 cookie
- 引入版本:WordPress 1.5.0
代码示例
$comment_author_url = apply_filters( 'pre_comment_author_url', $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] );
原文内容
Filters the comment author’s URL cookie before it is set.
Description
When this filter hook is evaluated in wp_filter_comment() , the comment author’s URL string is passed.
Parameters
$author_url_cookiestring-
The comment author URL cookie.
Source
$comment_author_url = apply_filters( 'pre_comment_author_url', $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] );
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |