Skip to content

Instantly share code, notes, and snippets.

@iamchetanp
Created January 24, 2020 20:59
Show Gist options
  • Save iamchetanp/db376f0463cad0391dd018c7b1bf1ef4 to your computer and use it in GitHub Desktop.
Save iamchetanp/db376f0463cad0391dd018c7b1bf1ef4 to your computer and use it in GitHub Desktop.
Divi Theme - Remove extra image sizes
/**
* Remove extra image sizes
*
* @param array $sizes Array of image sizes.
*/
function cpdivi_remove_extra_image_sizes( $sizes ) {
unset( $sizes['et-pb-post-main-image'] );
unset( $sizes['et-pb-post-main-image-fullwidth'] );
unset( $sizes['et-pb-portfolio-image'] );
unset( $sizes['et-pb-portfolio-module-image'] );
unset( $sizes['et-pb-portfolio-image-single'] );
unset( $sizes['et-pb-gallery-module-image-portrait'] );
unset( $sizes['et-pb-post-main-image-fullwidth-large'] );
unset( $sizes['medium_large'] );
unset( $sizes['1536x1536'] );
unset( $sizes['2048x2048'] );
unset( $sizes['et-pb-image--responsive--desktop'] );
unset( $sizes['et-pb-image--responsive--tablet'] );
unset( $sizes['et-pb-image--responsive--phone'] );
return $sizes;
}
add_action( 'intermediate_image_sizes_advanced', 'cpdivi_remove_extra_image_sizes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment