Skip to content

Instantly share code, notes, and snippets.

@themightymo
Created October 20, 2020 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themightymo/45cddd09c9fdbddba54c55acb38477a1 to your computer and use it in GitHub Desktop.
Save themightymo/45cddd09c9fdbddba54c55acb38477a1 to your computer and use it in GitHub Desktop.
Remove/Disable WordPress Featured Images/Thumbnails in functions.php or plugin
/*
Disable auto-generated thumbnails. Via
- https://wordpress.stackexchange.com/questions/91166/how-to-disable-wordpress-from-creating-thumbnails
- https://wordpress.stackexchange.com/questions/260609/remove-image-size-doesnt-seem-to-be-working
*/
function add_image_insert_override($sizes){
unset( $sizes['thumbnail']);
unset( $sizes['medium']);
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'add_image_insert_override' );
function remove_image_sizes() {
if ( function_exists( 'add_image_size' ) ) {
remove_image_size( 'et-pb-portfolio-image');
remove_image_size( 'et-pb-portfolio-module-image');
remove_image_size( 'et-pb-portfolio-image-single');
remove_image_size( 'et-pb-gallery-module-image-portrait');
remove_image_size( 'et-pb-post-main-image-fullwidth-large');
remove_image_size( 'et-pb-image--responsive--desktop');
remove_image_size( 'et-pb-image--responsive--tablet');
remove_image_size( 'et-pb-image--responsive--phone');
}
}
add_action('after_setup_theme', 'remove_image_sizes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment