By default, WordPress compresses JPEG images during upload to reduce file size. This snippet disables that compression by setting the image quality to 100%, preserving maximum image quality for photographers, designers, and portfolio websites.
Steps
- Open your active theme’s
functions.phpfile or a custom functionality plugin. - Add the code below.
- Save the file.
- Upload a new JPEG image. It will now be saved at full quality.
/**
* Set JPEG image quality to 100%.
*/
function wpfolks_set_jpeg_quality( $quality ) {
return 100;
}
add_filter( 'jpeg_quality', 'wpfolks_set_jpeg_quality' );