The Must Have for WordPress
The Must Have for WordPress
×
  • Home
December 5, 2019
PHP WordPress

Customize the default WordPress Image Compression

by Martin Jost
No comments
1 min Reading Time
1.39 K Views
5 Score
3 Likes
Share on Facebook Tweet on Twitter Share on Linkedin Pin on Pinterest Send via E-Mail Send via WhatsApp

WordPress uses its own compression for images that are uploaded directly into WordPress. This happens automatically every time you upload an image. By default, the compression level of 82% is used. This ensures that the file size of images is reduced, but the image quality is not compromised too much.

How can I change the compression level of images?

Sometimes it may be useful to decrease or increase the compression level of images, for example, when automatic image quality reduction of WordPress is undesirable. To avoid the loss of image quality, we can use the filters jpeg_quality and wp_editor_set_quality.

Just paste the following code snippet into the functions.php file of your theme:

So, if you don’t want to use the automatically compression of images in WordPress, replace “82” with “100”. So your images will be uploaded uncompressed in the future.

Old images have to be regenerated!

Please note: The new image quality does not automatically apply to old images that have been previously uploaded. For this, all images must be regenerated. In this case you can use a plugin like Regenerate Thumbnails:

Regenerate Thumbnails

Once the plugin has gone through, the new image quality will also be applied to all older WordPress images.

Last updated: December 5, 2019

Customize the default WordPress Image Compression Score: 5 / 5 (2votes)
Share on Facebook Tweet on Twitter Share on Linkedin Pin on Pinterest Send via E-Mail Send via WhatsApp
Theme
The Author
Published by
Martin Jost

View all posts by Martin Jost

Related Posts
A
WordPress Anonymize IP address of WordPress comments

In the context of the European privacy policy regulations some regulations for web page owners a ...

Read More
R
WordPress Remove the URL field in the WordPress comments form

As we know, comments are often misused by website visitors to get external links. Outgoing links ...

Read More
C
Gutenberg Calculate the correct content width for the Gutenberg editor

The WordPress Gutenberg editor allows you to customize and edit web page content according to th ...

Read More
Read more
C
Previous Post
Customize or Modify the WordPress Post Excerpt
C
Next Post
Custom image sizes for your WordPress theme
Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Imprint
  • Privacy Policy
© 2016-2023 - wphave - The Must Have for WordPress
Login

Lost your password?

RequiredEssential cookies enable basic functions and are necessary for the proper functioning of the website.
  • Name: Cookie Status
  • Provider: Owner of this website
  • Purpose: Is necessary to check whether the user's web browser allows cookies.
  • Privacy Policy: https://wphave.com/privacy-policy/
  • Cookie Name(s): cookie_status
  • Duration: 1 Minute
  • Name: Cookie Consent
  • Provider: Owner of this website
  • Purpose: Is necessary to check whether the user agrees to allow opt-in cookies or not.
  • Privacy Policy: https://wphave.com/privacy-policy/
  • Cookie Name(s): cookieconsent_analytics, cookieconsent_marketing, cookieconsent_status
  • Duration: 1 Year
  • Name: Like Button
  • Provider: Owner of this website
  • Purpose: Is necessary to check whether the user has already gave a like for a specific post.
  • Privacy Policy: https://wphave.com/privacy-policy/
  • Cookie Name(s): like_btn_{POST_ID}
  • Duration: 21 Days
  • Name: Post Rating
  • Provider: Owner of this website
  • Purpose: Is necessary to check whether the user has already rate a specific post.
  • Privacy Policy: https://wphave.com/privacy-policy/
  • Cookie Name(s): rating_{POST_ID}
  • Duration: 7 Days
AnalyticsStatistics cookies collect information anonymously. This information helps us to understand how our visitors use our website.
  • Name: Google Analytics
  • Provider: Google LLC
  • Purpose: Google cookie for website analysis. Generates statistical data on how the visitor uses the website.
  • Privacy Policy: https://policies.google.com/privacy
  • Cookie Name(s): _ga, _gat, _gid
  • Duration: 2 Years