0

I am writing a plugin that will make use of an image service for resizing images. I want to keep the ability for users to select different image sizes, but I don't want Wordpress to create intermediate images sizes when uploading an image. The only image that should be saved in the uploads directory is the image that was uploaded.

How can I prevent Wordpress from creating the intermediate image sizes?

0

Use the intermediate_image_sizes filter and return an empty array:

add_filter( 'intermediate_image_sizes', '__return_empty_array' );

__return_empty_array is a helper function in WordPress, the above is all you need!

  • I tried this and it does successfully stop the other sizes being created, however the size drop down in the media library now only shows the full size, I require the sizes in that drop down to remain unchanged. Thanks for the response though! – AlnDvs Jun 10 '15 at 11:54
  • Try this filter instead: intermediate_image_sizes_advanced – TheDeadMedic Jun 10 '15 at 12:39
  • Tried intermediate_image_sizes_advanced, same problem as before, the sizes in the drop down disappear. Where does Wordpress do the actual resizing and file creation? – AlnDvs Jun 12 '15 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.