How to configure image compression in WordPress
By default, WordPress compresses every picture that is submitted. One way to increase loading speed and save storage space on your website is to compress your photos. The manual states that WordPress reduces JPEG picture quality to 90%. These days, every website owner needs to take into account mobile users, especially since most people have data plans that are restricted and since huge, uncompressed photos will take longer to load and will drive visitors away.This WordPress post explains how to set up picture compression.
Configuring Image Compression
To configure image compression in WordPress, follow these steps:
- Log into WordPress with the Administrator account.
- In the left sidebar, click Appearance and then click Theme File Editor:
- On the theme editor, select the currently used theme:
- The files of the theme will be listed at the right. Click on the functions.php file:
- At the end of the functions.php file, insert the following filter to increase the compression quality from 100 to70:
add_filter(‘compression_quality’, function($arg){return 70;}); - Click on the Update File to save changes to the functions.php file:
If you want to apply this change to all images previously uploaded, you will have to regenerate all thumbnails
Know more – How to compress files using cPanel or the command line