Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想显示其他用户为作者的所有帖子提交的评论总数!例如这样的:
get_author_posts_total_number_of_comments($author->ID);
任何想法 ?
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)); }