WordPress获取评论用户的信息

那么,我们能不能再输出一些评论者的信息呢?比如:某读者的最后评论时间,总的评论文章,最后评论内容,在本站总的评论数等,通过下面的代码您可以轻松实现://获取指定用户评论总数目function get_author_comment_count($comment_author_email){ global $wpdb; $...

那么,我们能不能再输出一些评论者的信息呢?比如:某读者的最后评论时间,总的评论文章,最后评论内容,在本站总的评论数等,通过下面的代码您可以轻松实现:

//获取指定用户评论总数目function get_author_comment_count($comment_author_email){    global $wpdb;    $comment_count = count($wpdb->get_results(    "SELECT comment_ID as author_count FROM $wpdb->comments WHERE comment_author_email = '$comment_author_email' "));    return $comment_count;}//获取指定用户最后评论内容function author_last_comment_content($comment_author_emails){$args = array(    'author_email' =>$comment_author_emails,    'number' => '1');$comments = get_comments($args);foreach($comments as $comment) :    return $comment->comment_content;endforeach;}//获取指定用户最后时间function author_last_comment_time($comment_author_emails){$args = array(    'author_email' =>$comment_author_emails,    'number' => '1');$comments = get_comments($args);foreach($comments as $comment) :    return $comment->comment_date_gmt;endforeach;}

给TA打赏
共{{data.count}}人
人已打赏
wordpress教程

wordpress分类相关优化 排除分类 分类模板问题

2023-2-16 15:50:53

wordpress教程

WordPress简单移除程序和插件更新提示

2023-2-16 15:50:55

【腾讯云】11.11云上盛惠!云服务器首年1.8折起,买1年送3个月!
11.11云上盛惠!海量产品·轻松上云!云服务器首年1.8折起,买1年送3个月!超值优惠,性能稳定,让您的云端之旅更加畅享。
查看更多相关信息>>
站长

(工作日 10:00 - 22:30 为您服务)

2026-05-13 01:25:30

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

猜你想问:

  • 购买的模板免费包安装吗?

  • 这个演示地址有吗?

  • 购买vip会员可以下载哪些模板?

您的留言我们已经收到,我们将会尽快跟您联系!
取消
立即选择任一渠道联系我们