How to configure image compression in WordPress

WordPress compresses all uploaded images by default. Compressing images is a technique that, in addition to saving storage space, improves the loading speed of your site. WordPress, according to the documentation, compresses JPEG images to 90% quality. Nowadays, every website owner must consider mobile users, especially because the majority of people have limited data plans, and large uncompressed images will slow down loading times, causing users to abandon the site.This articles describes how to configure image compression in WordPress.

Configuring Image Compression

To configure image compression in WordPress, follow these steps:

  1. Log into WordPress with the Administrator account.
  2. In the left sidebar, click Appearance and then click Theme File Editor:

  3. On the theme editor, select the currently used theme:

  4. The files of the theme will be listed at the right. Click on the functions.php file:

  5. 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;});
  6. 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.

More Information

For more information about image compressing and optimization, please visit:

Get Managed WordPress Hosting

Article Details

Other Articles in This Category

Show More

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

Usamos cookies con el fin de personalizar para usted nuestro sitio Web y analizar el uso de éste. Usted acepta esto haciendo clic en “Acepto” o al continuar usando el sitio Web. Hay más información sobre cookies en nuestra política de privacidad.