How to Prevent WordPress from Generating Image Sizes (Thumbnails)

When you use WordPress themes and plugins. They may have lots of image sizes registered. While image size is very useful feature of WordPress you may not need it for all cases.

I recently have a similar case where I allowed subscribers to upload images but they will never need various size images that WP will generate. They will only need the original size.

This small piece of code will prevent WordPress from generating image sizes. Off course I have added conditionals so only subscribers image upload will be affected.

If you use any thumbnail regenerate plugin. It may completely skip this code depending on how the plugin using the function. You may need to re-adjust the logic in order to cope with that.

PHP Code

add_filter('image_resize_dimensions', 'subscribers_image_resize_dimensions');

function subscribers_image_resize_dimensions( $output ){

    // do not create thumbnails for subscriber uploaded images.
    if( current_user_can( 'subscriber' ) ) {
        return false;

    return $output;