Exclude an image from being optimized when using Autoptimize

When using Autoptimize plugin with image optimization provided by ShortPixel you can exclude one or more images from being optimized and served from ShortPixel CDN like this:

  1. Install a code snippet plugin like this one
  2. add the code snippet below
    add_filter('autoptimize_filter_imgopt_noptimize','imgopt_excl');
    function imgopt_excl() {
    return 'some-image.png, another-image.jpg';
    }

The returned string is a comma-separated list of to be excluded images, and can be an exact filename or a full path or part of the path.

Still need help? Contact Us Contact Us