WordPress获取当前评论者信息函数:wp_get_current_commenter
WordPress函数wp_get_current_commenter()用于获取当前评论者的姓名、电子邮件和URL,该函数没有参数。
wp_get_current_commenter(): array
函数返回值
当前评论者信息的数组:
comment_author:当前评论者的名称;
comment_author_email:当前评论者的电子邮件地址;
comment_author_url:当前评论者的url地址;
函数使用示例
$current_commenter = wp_get_current_commenter();
返回示例:
Array
(
[comment_author] => 背字根
[comment_author_email] => beizigen@qq.com
[comment_author_url] => https://www.beizigen.com/
)
扩展阅读
wp_get_current_commenter()函数位于:wp-includes/comment.php
相关函数:
- comment_form()
- comments_template()

