I have been using the Avada theme quite happily for a few of my sites, up until I noticed what it was doing to the uploads folder!
I kid you not, the theme was creating an additional 13 intermediate image sizes, in the class-avada-init.php file. This is in addition to the three sizes created by WooCommerce and another three created by WordPress.
If you are the kind of person who uploads image at the size you intend to use them, you really don’t need WordPress creating an extra 19 images per uploaded image, and chewing through your account’s inodes.
WordPress additional image sizes
To stop WordPress creating additional images: Go to Settings -> Media and set all image sizes to 0, 0.
WooCommerce additional image sizes
To stop WooCommerce creating additional images: WooCommerce -> Settings -> Products -> Display, and set any unused sizes to 0, 0.
Theme additional image sizes
To deal with your theme’s additional image sizes, I found this tutorial from tutsplus.com extremely helpful. I am going to paste in the code needed for Avada, but it is easily customised for your own bloaty theme.
Warning: it is best to do this in your child theme, not directly in the theme.
Add the following to the functions.php file of your child theme. The first few lines should already be there, but I’m leaving them in just in case you are new to child themes. You need to know what the theme has called the additional image sizes. If you don’t know, you could do a text search through the theme files for add_image_size
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
add_filter( 'intermediate_image_sizes_advanced', 'remove_parent_image_sizes' );
function remove_parent_image_sizes( $sizes ) {
unset( $sizes['blog-large'] );
unset( $sizes['blog-medium'] );
unset( $sizes['tabs-img'] );
unset( $sizes['related-img'] );
unset( $sizes['portfolio-full'] );
unset( $sizes['portfolio-one'] );
unset( $sizes['portfolio-two'] );
unset( $sizes['portfolio-three'] );
unset( $sizes['portfolio-four'] );
unset( $sizes['portfolio-five'] );
unset( $sizes['portfolio-six'] );
unset( $sizes['recent-posts'] );
unset( $sizes['recent-works-thumbnail'] );
return $sizes;
}
?>
After you have saved that to functions.php, and activated your child theme, you will need to run the wonderful Force Regenerate Thumbnails plugin, to remove all the additional sizes and clean up your media folder.
Nice, Melissa – I also freaked out when I realised that this was happening.
I am using a slightly different function.
add_action(‘init’, ‘disable_thumbs’);
function disable_thumbs(){
remove_image_size(‘blog-large’);
remove_image_size(‘tabs-img’);
remove_image_size(‘related-img’);
remove_image_size(‘portfolio-full’);
remove_image_size(‘portfolio-one’);
remove_image_size(‘portfolio-two’);
remove_image_size(‘portfolio-three’);
remove_image_size(‘portfolio-four’);
remove_image_size(‘portfolio-five’);
remove_image_size(‘portfolio-six’);
remove_image_size(‘recent-posts’);
remove_image_size(‘recent-works-thumbnail’);
}
I keep the blog-medium image for images on the blog page using the medium layout.
I wonder if the regenerate thumbnails plugin would work with that snippet?
(PS – go to Users > Your Profile – or whatever account you use to blog – and fill in the Biographical Info section. That will then appear above under “About the Author: Melissa Freeman”.Then get a Gravatar and it will appear in place of the anonymous image you currently have)
Thanks for the tip, Keely :) I’ll get right onto it.
Hi Melissa,
Thanks for this post. I followed your steps and it works a treat in Avada 4.03 / WP 4.5.3! Thank you kindly.
On searching further, I see that Avada also create these sizes by default so I included this with your code:
unset( $sizes[‘200’] );
unset( $sizes[‘400’] );
unset( $sizes[‘600’] );
unset( $sizes[‘800’] );
unset( $sizes[‘1200’] );
For some reason I still get images at 768 which I cant seem to track down (I have media thumbs at 300 x 300 and medium at 800 / 600) but can live with that I guess. If you know where that comes from I would love to know.
Cheers again
You’re very welcome! Wow. A new Avada version, new extra bloat. I’ll keep an eye open for it. Do you have WooCommerce? WooCommerce also has media sizes in its settings.