wp_get_current_commenter
云策文档标注
概述
wp_get_current_commenter 是一个 WordPress 过滤器,用于修改当前评论者的姓名、邮箱和 URL 数据。它允许开发者通过 apply_filters 钩子来调整这些信息。
关键要点
- 过滤器名称:wp_get_current_commenter
- 参数:$comment_author_data 数组,包含 comment_author、comment_author_email 和 comment_author_url 三个键值对
- 用途:在获取当前评论者信息时,允许自定义或过滤数据
- 相关函数:wp_get_current_commenter() 函数使用此过滤器
- 引入版本:WordPress 3.1.0
代码示例
return apply_filters( 'wp_get_current_commenter', compact( 'comment_author', 'comment_author_email', 'comment_author_url' ) );
原文内容
Filters the current commenter’s name, email, and URL.
Parameters
$comment_author_dataarray-
An array of current commenter variables.
comment_authorstringThe name of the current commenter, or an empty string.comment_author_emailstringThe email address of the current commenter, or an empty string.comment_author_urlstringThe URL address of the current commenter, or an empty string.
Source
return apply_filters( 'wp_get_current_commenter', compact( 'comment_author', 'comment_author_email', 'comment_author_url' ) );
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |