WebP Migrator for W3TC
WebP Migrator for W3TC is a companion plugin for W3 Total Cache that finishes the job once W3TC ImageService has converted an image to WebP. No changes to .htaccess , mod_rewrite , or web server configuration are required. Instead, it writes the replacement back into the database once , unlike a run
WebP Migrator for W3TC is a companion plugin for W3 Total Cache that finishes the job once W3TC ImageService has converted an image to WebP.
No changes to .htaccess , mod_rewrite , or web server configuration are required. Instead, it writes the replacement back into the database once , unlike a runtime content filter that swaps URLs on every request: as soon as W3TC marks an attachment as converted, every occurrence of that image’s URL — in post_content , widget instances, and theme mod settings (e.g. a Customizer background image) — is permanently replaced, from its original extension (jpg/jpeg/png/gif) to .webp . This covers absolute, root-relative, and protocol-relative URL forms, since hand-authored content (most commonly the Customizer’s “Additional CSS” field) frequently omits the scheme and/or host. The attachment’s own record (attached file, metadata, mime type) is updated to match, so the Media Library and REST API stay consistent too.
Optionally, once an image has been fully replaced, the plugin can delete the now-unused original source files from disk to reclaim storage space.
This is an independent, unofficial add-on and is not affiliated with, endorsed by, or sponsored by BoldGrid / W3 EDGE, the makers of W3 Total Cache. “W3 Total Cache” is a trademark of its respective owner and is used here only to describe compatibility.
Features
- Listens for W3TC ImageService conversions and reacts automatically.
- Regenerates any intermediate size W3TC itself failed to convert (this can happen silently, e.g. for Site Icon sizes that are only registered in certain admin contexts) directly from the already-converted full-size WebP, instead of waiting indefinitely for an event that never comes.
- Replaces every reference to the converted image (full size and all intermediate sizes) — in post_content across all posts, widget instances, and theme mod settings — as absolute, root-relative, or protocol-relative URLs.
- Updates the attachment’s own file reference, metadata, and mime type to match.
- Optional: deletes the original source files after a successful replacement.
- A source file is only ever deleted once its .webp counterpart has been confirmed to exist inside the uploads directory as a valid, non-empty image.