Tag Archives: meta value

count all meta values

function post_vierer(){
	global $wpdb;
	$result = $wpdb->get_results ("SELECT sum(meta_value) AS total FROM ".$wpdb->prefix."postmeta WHERE meta_key = 'post_views_count'");
	echo $result[0]->total;
}

Display
post_vierer();

%d bloggers like this: