Thumbnail size not being generated
-
Hello,
Hello, I tried the method at the following link to disable image sizes being generated by WP core”: https://advent.elliottrichmond.co.uk/how-to-disable-all-unwanted-image-sizes/
I tried this on an ‘untouched’ Twenty Twenty One theme. WP core is up to date and no plugins are active.
When I take out the line for thumbnail (first line), and my Media settings set the thumbnail to 150×150, no matter what, the thumbnail does not generate when I upload a new image (refreshed media library page too, just in case, and I’m not trying to apply this retroactively to past images).
My media settings: https://cloudup.com/cZL56bg8u74
I have tried commenting out the other lines one-by-one, then refreshing the Media library and uploading a new image to see if something else is causing the thumbnail not to generate.
Even when all the other lines are commented out (i.e. every other image size), the thumbnail does not generate. It’s only when I remove the code snippet entirely that the 150×150 thumbnail comes back when I upload a new image.
See screenshot when code is enabled (without the thumbnail line): https://cloudup.com/cLAwg6E-sSo –> The 150×150 thumbnail is not generated.
And when I remove all of it: https://cloudup.com/ciyBSt3Raa3 –> The 150×150 thumbnail is generated.
Code I’m using in functions.php in Twenty Twenty One is as follows:
// disable generated image sizes - https://advent.elliottrichmond.co.uk/how-to-disable-all-unwanted-image-sizes/ function shapeSpace_disable_image_sizes($sizes) { unset($sizes['medium']); // disable medium size unset($sizes['large']); // disable large size unset($sizes['medium_large']); // disable medium-large size unset($sizes['1536x1536']); // disable 2x medium-large size unset($sizes['2048x2048']); // disable 2x large size return $sizes; } add_action('intermediate_image_sizes_advanced', 'shapeSpace_disable_image_sizes'); // completely disable image size threshold - https://developer.www.ads-software.com/reference/hooks/big_image_size_threshold/ add_filter( 'big_image_size_threshold', '__return_false' );
When I add
add_theme_support( 'post-thumbnails' );
nothing changes (it was my wild guess as to how to bring it back).Do you know why? How can this be fixed?
I want to keep the 150×150 so that the Media Library can use that version of the image. Otherwise, in due time, I assume the Media library will be loading full-size (i.e. original) images which will take a long time to load.
Thank you
- The topic ‘Thumbnail size not being generated’ is closed to new replies.