0

我想显示其他用户为作者的所有帖子提交的评论总数!例如这样的:

get_author_posts_total_number_of_comments($author->ID);

任何想法 ?

4

1 回答 1

2
function get_author_posts_total_number_of_comments($authorID)
{
    global $wpdb;
    $sql = "SELECT SUM(comment_count) AS total FROM $wpdb->posts WHERE post_author=%d";
    return $wpdb->get_var($wpdb->prepare($sql,$authorID));
}
于 2013-01-03T16:33:29.580 回答