Build a safer image-optimization workflow
Use this workflow before Image Optimizer processes new uploads or rewrites an existing media library. The module replaces files after validation, so its off switch is not a restore operation.
Prepare a recoverable baseline
- Back up the uploads directory and database.
- Record representative JPEG, PNG, GIF, AVIF, and WebP filenames, dimensions, sizes, transparency, animation, and frontend crops.
- Confirm Imagick or GD and the required optimizer programs are available.
- Check writable directories and free disk space.
- Pause other image optimizers, media regenerators, imports, and bulk renamers.
Configure new uploads first
- Open Settings → POM Tweaks → Media → Media library.
- Enable Image optimizer and save.
- Upload one JPEG and one PNG through Media → Add Media File.
- Confirm Media → Library reports Size Savings.
- Inspect the main files, generated sizes, transparent areas, and all theme crops.
- Confirm that
.webpcompanions exist where expected, then verify separately whether the CDN or web server actually serves them.
Image Optimizer can resize the longest side to 2560 pixels, replaces the source after successful processing, and does not retain a permanent original. It also suppresses medium_large, 1536x1536, and 2048x2048 while active.
Combine media controls carefully
Use Settings → POM Tweaks → Media → Uploads and Attachment pages.
- Default image quality affects images encoded after activation; it does not recompress existing files by itself.
- Maximum upload size is only one WordPress limit. PHP, the web server, a proxy, and multisite can impose a lower maximum.
- SVG uploads, under Media → Uploads, sanitizes new SVG files. Existing files are not rewritten; Image Optimizer does not sanitize SVG.
- Configure hotlink protection through your hosting provider or CDN. Verify allowed origins, feeds, previews, and WebP delivery.
- Attachment-page 404 and parent-redirection modes affect public attachment URLs, not image compression.
Process the existing library
- Open Media → Image optimizer only after new-upload tests pass.
- Start with Optimize missing images.
- Keep the page open until Optimization complete appears.
- Review every attachment error and correct the underlying file or server condition.
- Use Optimize all images only when deliberate reprocessing is acceptable.
Closing the page stops the browser-driven sequence after the current request; completed attachments remain changed. Restore an earlier source from the external backup when reversal is required.