| 开发者 | tanupom |
|---|---|
| 更新时间 | 2026年8月23日 09:21 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
.htaccess tricks, no duplicate storage.
It uses your server's Imagick (ImageMagick) build to do the conversion, so heavy lifting stays on the server and the plugin itself stays small.
What it does
wp_handle_upload filter, replacing the original in place. If your server cannot output WebP (or HEIC/HEIF delegates are missing), the upload is passed through unchanged..webp URLs in your post content and options. Serialized options (widgets, theme mods) are handled with a serialize-safe replacement so the data does not break.wp_handle_upload filter and is converted to WebP as before, and the browser then generates every sub-size in that same WebP format.
This also unlocks HEIC/HEIF on servers whose Imagick build has no HEIC delegate. On 7.1 the browser decodes the HEIC itself, using the operating system's decoder, so the image reaches the server in a format Imagick can read. An iPhone photo then ends up as WebP rather than JPEG. Browser-side decoding depends on the platform doing the upload: Windows and macOS can do it, Linux currently cannot.
WordPress itself does not convert formats. Without this plugin a JPEG upload stays a JPEG, and a HEIC upload becomes a JPEG, on 7.1 just as on earlier versions.
Important: this is in-place and irreversible
This plugin replaces and deletes your original images, both at upload time and during bulk conversion. There is no automatic rollback. Back up your media library (and database) before running the bulk conversion.
Requirements
tanupom-in-place-converter-for-webp folder to /wp-content/plugins/, or install it from the Plugins screen.No. This plugin is deliberately "in place": it converts the originals to WebP and deletes the old files. This keeps your library to a single set of files. Make a backup before running it.
Not from within the plugin. Restore from your backup if you need the originals back. This is why a backup is required before conversion.
Your Imagick build can't output WebP. Ask your host to enable WebP support in ImageMagick/Imagick, or use a server that provides it.
Yes, since 0.2.0. New uploads of JPEG, PNG, BMP, HEIC, and HEIF go through the wp_handle_upload filter and are written to disk as WebP, replacing the original. The same conversion settings (quality, lossless PNG, strip metadata) are used.
If your server's Imagick build cannot output WebP, or HEIC/HEIF delegates are missing, the upload is passed through unchanged so nothing breaks.
After conversion, run Run reference replacement. It rewrites old image URLs to the new .webp URLs in post content and options, including serialized options, using a serialize-safe replacement.
The two conversion paths cover different formats:
wp_handle_upload filter, and sub-sizes generated in the browser inherit the converted WebP format.Domain Path and no longer calls load_plugin_textdomain().tanupom_ipc_replace_post_types filter were renamed to match.load_plugin_textdomain() call was removed.wp_handle_upload filter, with graceful fallback when the server cannot output WebP.post_content should be scanned during URL replacement.tanupom_ipc_replace_post_types filter so developers can override the scanned post types programmatically.