Description
Petro SEO Images to WebP converts your existing JPEG and PNG attachments to WebP in bulk, then serves them on the front-end through the standard <picture> element with a full responsive srcset. The original files stay untouched on disk, so reverting is as simple as flipping a switch.
Designed to be small, dependency-free and predictable. No external services, no images uploaded anywhere, no opaque queue.
What it does
- Converts every registered image size (full + thumbnails) to
.webpnext to the original (e.g.photo.jpgphoto.jpg.webp). - Wraps
<img>tags fromwp_get_attachment_image()andthe_contentin<picture><source type="image/webp">…</picture>, preserving fullsrcsetandsizes. - Skips images automatically if a previous run failed because of filesystem permissions, so you can retry on demand without reprocessing the whole library.
- Ramps the WebP quality down (75 60 45 40) when the encoded file ends up larger than the original, so you never ship a “WebP” that is heavier than the JPEG.
- Idempotent: re-running the bulk job only touches new or updated images.
What it does NOT do
- It does not delete or modify your original JPG/PNG files.
- It does not require Imagick or a specific image library beyond what WordPress already uses (
wp_get_image_editor()). - It does not phone home, register endpoints, or load remote scripts.
Privacy
The plugin processes images locally using WordPress’s built-in image editor. No data is sent to third-party services.
Screenshots
→ Petro SEO Images to WebP — settings, bulk-conversion counters, and Convert / Revert / Retry controls.” class=”wp-image-9000001″ srcset=”https://i0.wp.com/ps.w.org/petro-seo-images-to-webp/assets/screenshot-1.png?rev=3533935&w=300 300w, https://i0.wp.com/ps.w.org/petro-seo-images-to-webp/assets/screenshot-1.png?rev=3533935&w=600 600w, https://i0.wp.com/ps.w.org/petro-seo-images-to-webp/assets/screenshot-1.png?rev=3533935&w=900 900w” sizes=”(max-width: 599px) 50vw, 33vw” width=”1836″ height=”1162″ loading=”eager” fetchpriority=”high” decoding=”async”/>Installation
- Upload the
petro-seo-images-to-webpfolder to/wp-content/plugins/, or install via the Plugins screen. - Activate the plugin through the Plugins screen.
- Go to Media Petro SEO Images to WebP.
- Click Convert all to process the existing library.
- Make sure Serve WebP is enabled to wrap front-end images in
<picture>.
FAQ
-
Will this overwrite my original images?
-
No. Originals stay on disk. The plugin writes a sibling file with the
.webpextension (e.g.photo.jpgandphoto.jpg.webp). -
How can I undo the conversion?
-
On Media Petro SEO Images to WebP, click Revert all. Every generated
.webpfile is removed and the tracking metadata is cleared. -
Some images were skipped. Why?
-
The most common cause is a write-permission issue on the uploads folder. Fix the directory permissions (e.g.
chown www-data:www-dataon Linux) and click Retry skipped to reprocess only those. -
Does it work with responsive images / srcset?
-
Yes. The
<source>element inside<picture>carries the fullsrcsetandsizes, with each URL pointing to its.webpcounterpart. URLs whose.webpis missing on disk are silently dropped from the WebPsrcsetso the browser falls back to the original<img>. -
Can I serve `.webp` files without using the “ tag?
-
If you uncheck Serve WebP the files stay on disk but the plugin will not wrap your
<img>markup. You can then serve them yourself (e.g. via Nginx Accept negotiation or a CDN rule). -
What if the WebP version ends up larger than the original?
-
The plugin retries with progressively lower quality (down to 40). If even at the lowest quality the WebP is still bigger than the source, it logs a diagnostic line and uses what it has — most browsers will still benefit from the format.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Petro SEO Images to WebP” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Petro SEO Images to WebP” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.1.2
- Admin UI polish: ASCII-art header on Media Petro SEO Images to WebP and a discreet author credit linking to the wordpress.org profile. No functional changes — purely cosmetic.
1.1.1
- Plugin Check pass: drop empty
.gitkeepplaceholders fromincludes/andassets/(they no longer make it into the release zip). - Replace direct
is_writable()/chmod()filesystem calls withwp_is_writable(); the opportunisticchmod 0755self-heal is gone — read-only directories now surface a clean permission error instead of being silently patched. - Drop the
load_plugin_textdomain()call; wordpress.org auto-loads translations since WP 4.6. - Wrap
uninstall.phplogic in apsitw_uninstall()function so locals stay out of the file scope. - Annotate the unavoidable direct
$wpdbqueries (uninstall sweep, namespace migration, skipped-meta cleanup) andmeta_query/post__not_incalls with justifiedphpcs:ignorecomments.
1.1.0
- Rebrand to Petro SEO Images to WebP: new plugin slug
petro-seo-images-to-webp, new internal prefixPsitw_*/psitw_*(5-letter prefix per WordPress plugin guidelines). A one-time auto-migration on first load forwards every legacy storage key (siw_*andplugin_images_*) into the new namespace, so existing conversion state is preserved. - The admin page moved to Media Petro SEO Images to WebP.
1.0.4
- Rename internal class prefix and storage keys to
siw_*for unique namespacing — a one-time auto-migration runs on first load and copies legacy data forward. - Replace
@unlinkwithwp_delete_file()and addPlugin URI,Author URI,Requires at leastheaders for wordpress.org compliance. - Trim readme tags to 5, bump tested-up-to, exclude dev-only docs from the release zip.
1.0.3
- Skip attachments that fail because of filesystem permissions and offer a one-click retry flow.
- Ramp quality down when the resulting WebP is larger than the original.
- Keep the bulk loop alive when an entire batch fails by excluding failed IDs.
- Preserve full responsive
srcsetinside the generated<picture><source>.
1.0.0
- Initial public release.
