Created
October 20, 2020 14:10
-
-
Save themightymo/45cddd09c9fdbddba54c55acb38477a1 to your computer and use it in GitHub Desktop.
Remove/Disable WordPress Featured Images/Thumbnails in functions.php or plugin
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
/* | |
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