How to use lossless compression with WP_Image_Editor

With @jgraup ‘s help in comments, I had a look at the responsive images plugin linked there. While that particular one has several other filters on things like post content which I would have preferred not to use, the RespImg class included is exactly what I was wanting. I was originally considering what would be … Read more

Run function before uploaded image is saved

WordPress already compresses jpeg files, doing it a second time will just degrade the quality with recompression artefacts Instead, adjust the compression percentage via the jpeg_quality filter: add_filter( ‘jpeg_quality’, function() { return 80; // 80% });

Enable compression

I assume you want to enable gzip compression for your website but it cannot be done on the WordPress itself, first, it has to be supported by the server and then server configuration needs to be changed. If your hosting is on Apache (most likely it is) then you can add these lines into .htaccess … Read more