You can try this code. global $wpdb; $meta_key = 'link_click_counter'; $all_downloads = $wpdb->get_var($wpdb->prepare(" SELECT sum(meta_value) FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key)); echo $all_downloads;