-
cccrane
I am trying to prevent multiple image sizes being created when I upload images, and also remove the alternate image size files. (I use Optimole and I don’t need them or want them taking up space.)
I’ve changed the WordPress settings to 0 so it doesn’t create those thumbnail, medium, and large sizes. I’ve read that themes can add their own sizes. Does GeneratePress add any registered thumbnails? I still get 1536×1157 and 768×578 images when I regenerate thumbnails and I don’t know why.
Thanks!
Catherine -
Alvind
Hi Catherine,
No, GeneratePress does not register any custom thumbnail sizes. The theme relies entirely on WordPress’s default image sizes.
I still get 1536×1157 and 768×578 images when I regenerate thumbnails and I don’t know why.
Those are WordPress core’s hidden image sizes that don’t appear in Settings > Media. You can try adding the snippet below to disable them:
// Disable WordPress's hidden image sizes function disable_wordpress_responsive_images() { // Disable medium_large size (768px) update_option( 'medium_large_size_w', 0 ); update_option( 'medium_large_size_h', 0 ); // Remove 1536x1536 and 2048x2048 sizes remove_image_size( '1536x1536' ); remove_image_size( '2048x2048' ); } add_action( 'init', 'disable_wordpress_responsive_images' ); // Also prevent them from being generated add_filter( 'intermediate_image_sizes', function( $sizes ) { return array_diff( $sizes, array( 'medium_large', '1536x1536', '2048x2048' ) ); });Adding PHP: https://docs.generatepress.com/article/adding-php/
After adding the snippet, regenerate your thumbnails again — those sizes should no longer be created.
- You must be logged in to reply to this topic.