Alex
Alex

Reputation: 21

Can't keep Wordpress from generating thumbnails

What I want is to prevent Wordpress from generating thumbnail images (additional sizes) when Media uploader in admin is used or when wp_generate_attachment_metadata() + wp_update_attachment_metadata() is used.

To do so I have set Thumbnail size, Medium size and Large size to 0 - 0 in Settings/Media in admin menu. However, Wordpress still keeps generating these additional size images.

What am I doing wrong?

Upvotes: 1

Views: 364

Answers (2)

Pimpfru
Pimpfru

Reputation: 385

Try this in functions.php:

// Prevent WordPress from generating additional image sizes
function shapeSpace_customize_image_sizes($sizes) {
    unset($sizes['thumbnail']);
    unset($sizes['medium']);
    unset($sizes['medium_large']);
    unset($sizes['large']);
    return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'shapeSpace_customize_image_sizes');
add_filter('max_srcset_image_width', create_function('', 'return 1;'));

Works for me. You'll end up with only original image uploaded to WordPress through Media Library.

Upvotes: 1

UnpassableWizard
UnpassableWizard

Reputation: 1279

Try in theme's functions.php:

wordpress-folder/wp-content/themes/theme-name/functions.php

a line looking like :

add_image_size( 'homepage-thumb', 220, 180, true ); 

and also:

set_post_thumbnail_size( 150, 150 );

remove the lines, or uncomment them if you're not sure.

Hope that works together with what you already made.

Upvotes: 0

Related Questions