I have noticed that whenever I add a new image to a post or page, 5 or more duplicates of the same images are created in my WordPress wp-content/uploads
folder.
How can I stop that?
I have noticed that whenever I add a new image to a post or page, 5 or more duplicates of the same images are created in my WordPress wp-content/uploads
folder.
How can I stop that?
You can use filter intermediate_image_sizes
with an empty array.
add_filter( 'intermediate_image_sizes', '__return_empty_array' );
The above code will disable all kind of thumbnail generation.
function wh_removeImageSize($sizes)
{
unset($sizes['thumbnail']);
unset($sizes['medium']);
unset($sizes['large']);
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'wh_removeImageSize');
All code goes in function.php file of your active child theme (or theme). Or also in any plugin php files.
All code is tested and works.
Hope this helps!
I just used DNUI plugin that detects and deletes any unused image in the site and it works perfectly. Don't know why exactly the images are being duplicated, but the problem was minimized and controlled.