Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To stop WordPress creating intermediate image files during upload, use the intermediate_image_sizes_advanced filter. Return an empty array to suppress all sizes handled by that filter, or remove selected sizes if your theme or plugins still need them. WordPress’s separate large-image scaling feature requires a different filter.

Stop WordPress from generating intermediate image sizes

Add the filter in a site-specific plugin or in your active theme’s setup code so it runs when WordPress registers filters. To suppress every intermediate size handled by this filter, use:

add_filter(
    'intermediate_image_sizes_advanced',
    '__return_empty_array'
);

The filter receives the associative array of registered sizes WordPress is about to create while generating attachment metadata. Returning an empty array prevents those intermediate sizes from being created for uploads that pass through the filter. WordPress documents attachment metadata generation and the intermediate_image_sizes_advanced filter.

Keep some sizes and remove only others

If your site relies on particular sizes, edit the array in a callback instead of removing everything. The keys identify registered sizes; unset only the entries you have confirmed are unnecessary, then return the updated array:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
add_filter(
    'intermediate_image_sizes_advanced',
    function ( $sizes ) {
        unset( $sizes['medium_large'] );
        return $sizes;
    }
);

This example removes the medium_large entry only if it is present. Check your site’s actual registrations before using it: WordPress core, the active theme, and plugins can all add sizes. The add_image_size() reference explains how themes and plugins register custom dimensions and notes their use in featured-image templates.

Check which image sizes your site needs

Before suppressing sizes, identify what is registered and where the site uses it. Removing a size from upload processing can affect theme layouts, featured images, or plugin features that request that size. A size may be generated even if it is not visible in a typical page, so verify the relevant templates and integrations rather than assuming every custom size is redundant.

  • Review theme and plugin code for custom sizes registered with add_image_size().
  • Check templates and features that display thumbnails, featured images, or other image variants.
  • Test representative pages and uploads after changing the filter.

Disable large-image scaling separately

The intermediate_image_sizes_advanced filter does not control WordPress’s large-image scaling. For that behavior, use the separate big_image_size_threshold filter. WordPress’s code reference documents a default threshold of 2560 pixels for the maximum width and height; an original is scaled when either dimension exceeds the threshold. Returning false from the filter callback disables that scaling. See the big_image_size_threshold reference.

add_filter( 'big_image_size_threshold', '__return_false' );

Use this only if you want to stop the large-image -scaled behavior. It does not stop thumbnail or other intermediate-size generation, and suppressing intermediate sizes does not itself disable large-image scaling.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What changes for existing images?

These filters affect processing; they do not automatically delete files already generated in the uploads directory. Removing a size registration also does not generally remove its existing files. WordPress’s add_image_size() documentation describes this limitation, and wp_generate_attachment_metadata() does not check for or delete intermediate files it created for the same attachment earlier.

Treat cleanup as a separate maintenance task. Back up the media library and check that no posts, theme templates, or plugins reference the files before deleting anything. Changing the filter is not a cleanup operation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test the upload path your site actually uses

Upload processing can vary by editor and WordPress version. The Block Editor handbook explains that modern client-side uploads can call wp_generate_attachment_metadata once with context create, then again with context update after a finalize request. It also notes that client-side processing uses size filters while some server-side image hooks do not fire. Consult the Block Editor filters handbook and test uploads through the editor your site uses, with its theme and plugins active.

Verify both the resulting attachment sizes and the pages that display them. Do not assume that a hook associated with server-side processing will run identically for every client-side upload workflow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.