wp_get_current_commenter()
wp_get_current_commenter() 获取当前评论者的姓名、电子邮件和URL。 Get cur…
wp_get_current_commenter()
获取当前评论者的姓名、电子邮件和URL。
Get current commenter’s name, email, and URL.
获取当前评论者的姓名、电子邮件和URL。
Get current commenter’s name, email, and URL.
目录锚点:#说明#参数#源码#笔记
说明(Description)
预期Cookie内容已被清除。此函数的用户可能希望重新检查返回数组的有效性。另请参见#另请参阅sanitize_comment_cookies():用于清理Cookie
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|
源码(Source)
/**
* Get current commenter's name, email, and URL.
*
* Expects cookies content to already be sanitized. User of this function might
* wish to recheck the returned array for validity.
*
* @see sanitize_comment_cookies() Use to sanitize cookies
*
* @since 2.0.4
*
* @return array Comment author, email, url respectively.
*/
function wp_get_current_commenter() {
// Cookies should already be sanitized.
$comment_author = '';
if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) )
$comment_author = $_COOKIE['comment_author_'.COOKIEHASH];
$comment_author_email = '';
if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) )
$comment_author_email = $_COOKIE['comment_author_email_'.COOKIEHASH];
$comment_author_url = '';
if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) )
$comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH];
/**
* Filter the current commenter's name, email, and URL.
*
* @since 3.1.0
*
* @param string $comment_author Comment author's name.
* @param string $comment_author_email Comment author's email.
* @param string $comment_author_url Comment author's URL.
*/
return apply_filters( 'wp_get_current_commenter', compact('comment_author', 'comment_author_email', 'comment_author_url') );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.0.4 | wp-includes/comment.php | 4 | 12 |
笔记(Notes)
获取当前评论者详细信息
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!