QQ咨询不加好友发不了信息,咨询前先加好友! → QQ:820896380

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}}人
人已打赏
豆包可以帮你高效完成AI问答、AI对话、提供软件相关教程以及解决生活中遇到的各种疑难杂症,还能帮助你进行AI写作、AI绘画等等,提高你的工作学习效率。
!
你也想出现在这里?立即 联系我们吧!
信息
个人中心
购物车
优惠劵
今日签到
搜索