Reputation: 4050
In my Settings -> Media I have the following settings:
No other plugins enabled. When I upload a 2560×1920 pixels image, I would expect 3 files to exist, a 512,1024, and original 2560 wide image. However I also get a 768, 1536, 2048, and -scaled (which is the same dimensions as the original). I have a custom theme that doesn't add any image sizes, and while I could understand the 2048 as the retina version of the 1024 image, the 768 and 1536 ones are a mystery to me.
Even when I set 0 for thumbnail, medium, and large in the media settings I still get a 768, 1536, 2048 and -scaled version generated when I upload an image.
Is there any way to prevent WordPress from generating these extra images that I don't want?
I set all the media settings to 0 and added
remove_image_size('1536x1536');
remove_image_size('2048x2048');
add_filter( 'big_image_size_threshold', '__return_false' );
to a function in add_action( 'after_setup_theme', 'myfunction')
That gets rid of the 1536 and 2048 transforms (despite the fact that the transformed images have heights other than 1536 and 2048 but oh well), as well as the -scaled
one. However even if I add remove_image_size('2048x2048');
WP still generates a 768 wide transform along with keeping the original.
How can I get rid of that last one?
Upvotes: 1
Views: 831
Reputation: 4050
add_filter( 'intermediate_image_sizes', '__return_empty_array', 999 );
Does the trick. For some reason, the 768 wide image transform is the medium_large
preset that you cannot remove with remove_image_size('medium_large');
like the rest.
Upvotes: 1