Regardless of size uploaded, I need Wordpress to compress the original full size image to 30% upon upload. Full size is the only image I use.

I have already disabled all thumbnail creation upon upload. I have added a filter to change the compression of thumbnails to 30%.

add_filter('jpeg_quality', function($arg){return 30;});

However, as you know, the original upload is not compressed but retained as the full size original. I want to compress it and either create a new thumbnail of the same dimensions (if I must) or ideally, overwrite the original full size image with the compressed version.

Any ideas other than plugins? I already have a functionality plugin I keep with all my custom functions. I would like to add the solution to that plugin if possible.


  • WordPress doesn't modify uploaded the file in any way. You would need to hook into the upload function (after the file is saved to the final location), and then process the file and compress it. – Milan Petrovic Apr 5 '18 at 19:56

Your Answer

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

Browse other questions tagged or ask your own question.