How to remove image sizes uploaded to WordPress media library

Last Updated on November 11, 2023 by Mike Kipruto

WordPress generates various “image sizes” for images uploaded to the media library.

Media Library 

The Media Library Screen allows you to edit, view, and delete previously uploaded media to your blog. Multiple Media objects can be selected for deletion. You can also search and filter for the desired Media.

media library

WordPress generates three pre-defined image sizes by default and keeps the original. The following are the default resolutions for the three generated image sizes:

  • Thumbnail: 150px square
  • Medium size: maximum width and height of 300px
  • Large size: maximum width and height of 1024px
  • Full size: the original/full image size that you uploaded.

To remove specific image sizes from being generated when uploading images, you can use the intermediate_image_sizes_advanced filter hook.

Here is a code you can use to remove it:

add_filter( 'intermediate_image_sizes_advanced', 'remove_image_sizes', 10, 3 );

function remove_image_sizes( $new_sizes, $image_meta, $attachment_id ) {
    // Remove 'thumbnail' and 'medium' image sizes
    unset( $new_sizes['thumbnail'] );
    unset( $new_sizes['medium'] );

    // Return the modified array of image sizes
    return $new_sizes;