Remove unnecessary wordpress image sizes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* WordPress: Remove unwanted image sizes. | |
* Remove the three sizes medium_large, 1536x1536, 2048x2048 | |
* Not needed for 99% of Woocommerce stores | |
*/ | |
add_filter('intermediate_image_sizes', function($sizes) { | |
return array_diff($sizes, ['medium_large']); // Medium Large (768 x 0) | |
}); | |
add_action( 'init', 'j0e_remove_large_image_sizes' ); | |
function j0e_remove_large_image_sizes() { | |
remove_image_size( '1536x1536' ); // 2 x Medium Large (1536 x 1536) | |
remove_image_size( '2048x2048' ); // 2 x Large (2048 x 2048) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment