I'm trying to remove the default image sizes that are created given a specific image size threshold.
Listed using this:
get_intermediate_image_sizes() // thumbnail [1] => medium [2] => medium_large [3] => large [4] => 1536x1536 [5] => 2048x2048
I've found this method remove_image_size which doesn't work for the default ones.
I've found this snippet:
add_filter( 'intermediate_image_sizes_advanced', function($sizes){
unset( $sizes['small']);
unset( $sizes['medium']);
unset( $sizes['large']);
unset( $sizes['medium_large']);
return $sizes;
});
Which appears to do nothing.
Anyone got an idea as to how I'd go about removing the default image sizes?
Edit: The accepted answer is correctly how you remove the default image_sizes globally. If you'd rather want to switch between when different image_sizes should be active for which specific image assets then there's a way to do that here: image_size with respect to aspect ratios
medium_large
isn't a default image size to my knowledge, I'm assuming this was the other snippet you tried? developer.wordpress.org/reference/functions/remove_image_size/…