Here’s a shortcode to get the total number of images uploaded to the entire website in WordPress.
Shortcode: [total_images]
Code for the shortcode:
//To get total images uploaded
function sw_total_images () {
$count = array_sum( (array) wp_count_attachments( $mime_type = 'image' ) );
return $count;
}
add_shortcode('total_images','sw_total_images');
PHPWherever you want to display the total images at site level, you can simply use the [total_images]
shortcode.
Related: