也许不是最优雅的解决方案
$authorPost = get_posts(array(\'author\' => 1));foreach ($catPost as $post) {
setup_postdata($post);
$ids[] = get_the_ID();
}
$idList = implode(",", $ids); //turn the array into a comma delimited list
$meta_key = \'post_view\';
$allview = $wpdb->get_var($wpdb->prepare("
SELECT sum(meta_value)
FROM $wpdb->postmeta
WHERE meta_key = %s
AND post_id in (" . $idList . ")", $meta_key));
echo \'user 1 All posts View Count\'.$allview .\'
\';