Created
July 22, 2018 11:59
-
-
Save heldervilela/a4cfa1bb9b9c4e4f4652df5c02214880 to your computer and use it in GitHub Desktop.
Remove default WordPress and WooComerce image crops
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
<?php | |
/** | |
* Remove default WordPress and WooComerce image crops | |
* | |
* @since 1.0.0 | |
* @access public | |
* | |
* @return void | |
*/ | |
add_filter( 'intermediate_image_sizes_advanced', function( $sizes ) { | |
/* Default WordPress */ | |
unset( $sizes[ 'medium' ]); // Remove Medium resolution (300 x 300 max height 300px) | |
unset( $sizes[ 'medium_large' ]); // Remove Medium Large (added in WP 4.4) resolution (768 x 0 infinite height) | |
unset( $sizes[ 'large' ]); // Remove Large resolution (1024 x 1024 max height 1024px) | |
/* WooCommerce */ | |
unset( $sizes[ 'shop_thumbnail' ]); // Remove Shop thumbnail (180 x 180 hard cropped) | |
unset( $sizes[ 'shop_catalog' ]); // Remove Shop catalog (300 x 300 hard cropped) | |
unset( $sizes[ 'shop_single' ]); // Shop single (600 x 600 hard cropped) | |
return $sizes; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment