Title: Petro SEO Images to WebP
Author: diegopetroncari
Published: <strong>2026 年 5 月 16 日</strong>
Last modified: 2026 年 5 月 16 日

---

搜索插件

![](https://ps.w.org/petro-seo-images-to-webp/assets/banner-772x250.png?rev=3533935)

![](https://ps.w.org/petro-seo-images-to-webp/assets/icon-256x256.png?rev=3533935)

# Petro SEO Images to WebP

 作者：[diegopetroncari](https://profiles.wordpress.org/diegopetroncari/)

[下载](https://downloads.wordpress.org/plugin/petro-seo-images-to-webp.1.1.2.zip)

 * [详情](https://cn.wordpress.org/plugins/petro-seo-images-to-webp/#description)
 * [评价](https://cn.wordpress.org/plugins/petro-seo-images-to-webp/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/petro-seo-images-to-webp/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/petro-seo-images-to-webp/#developers)

 [支持](https://wordpress.org/support/plugin/petro-seo-images-to-webp/)

## 描述

**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 `.webp` next to the
   original (e.g. `photo.jpg`  `photo.jpg.webp`).
 * Wraps `<img>` tags from `wp_get_attachment_image()` and `the_content` in `<picture
   ><source type="image/webp">…</picture>`, preserving full `srcset` and `sizes`.
 * 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.

## 屏幕截图

[⌊Admin page under Media → Petro SEO Images to WebP — settings, bulk-conversion 
counters, and Convert / Revert / Retry controls.⌉⌊Admin page under Media → Petro
SEO Images to WebP — settings, bulk-conversion counters, and Convert / Revert / 
Retry controls.⌉[

Admin page under **Media  Petro SEO Images to WebP** — settings, bulk-conversion
counters, and Convert / Revert / Retry controls.

## 安装

 1. Upload the `petro-seo-images-to-webp` folder to `/wp-content/plugins/`, or install
    via the Plugins screen.
 2. Activate the plugin through the **Plugins** screen.
 3. Go to **Media  Petro SEO Images to WebP**.
 4. Click **Convert all** to process the existing library.
 5. Make sure **Serve WebP** is enabled to wrap front-end images in `<picture>`.

## 常见问题

### Will this overwrite my original images?

No. Originals stay on disk. The plugin writes a sibling file with the `.webp` extension(
e.g. `photo.jpg` and `photo.jpg.webp`).

### How can I undo the conversion?

On **Media  Petro SEO Images to WebP**, click **Revert all**. Every generated `.
webp` file 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-data` on Linux) and click **Retry
skipped** to reprocess only those.

### Does it work with responsive images / srcset?

Yes. The `<source>` element inside `<picture>` carries the full `srcset` and `sizes`,
with each URL pointing to its `.webp` counterpart. URLs whose `.webp` is missing
on disk are silently dropped from the WebP `srcset` so 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.

## 评价

此插件暂无评价。

## 贡献者及开发者

「Petro SEO Images to WebP」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ diegopetroncari ](https://profiles.wordpress.org/diegopetroncari/)

[帮助将「Petro SEO Images to WebP」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/petro-seo-images-to-webp)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/petro-seo-images-to-webp/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/petro-seo-images-to-webp/)，或通过
[RSS](https://plugins.trac.wordpress.org/log/petro-seo-images-to-webp/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/petro-seo-images-to-webp/)。

## 更新日志

#### 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 `.gitkeep` placeholders from `includes/` and `assets/`(
   they no longer make it into the release zip).
 * Replace direct `is_writable()` / `chmod()` filesystem calls with `wp_is_writable()`;
   the opportunistic `chmod 0755` self-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.php` logic in a `psitw_uninstall()` function so locals stay out
   of the file scope.
 * Annotate the unavoidable direct `$wpdb` queries (uninstall sweep, namespace migration,
   skipped-meta cleanup) and `meta_query` / `post__not_in` calls with justified `
   phpcs:ignore` comments.

#### 1.1.0

 * Rebrand to **Petro SEO Images to WebP**: new plugin slug `petro-seo-images-to-
   webp`, new internal prefix `Psitw_*` / `psitw_*` (5-letter prefix per WordPress
   plugin guidelines). A one-time auto-migration on first load forwards every legacy
   storage key (`siw_*` and `plugin_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 `@unlink` with `wp_delete_file()` and add `Plugin URI`, `Author URI`,`
   Requires at least` headers 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 `srcset` inside the generated `<picture><source>`.

#### 1.0.0

 * Initial public release.

## 额外信息

 *  版本 **1.1.2**
 *  最后更新：**5 月前**
 *  活跃安装数量 **不到10**
 *  WordPress 版本 ** 5.8 或更高版本 **
 *  已测试的最高版本为 **6.9.9**
 *  PHP 版本 ** 7.1 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/petro-seo-images-to-webp/)
 * 标签
 * [images](https://cn.wordpress.org/plugins/tags/images/)[performance](https://cn.wordpress.org/plugins/tags/performance/)
   [picture](https://cn.wordpress.org/plugins/tags/picture/)[seo](https://cn.wordpress.org/plugins/tags/seo/)
   [webp](https://cn.wordpress.org/plugins/tags/webp/)
 *  [高级视图](https://cn.wordpress.org/plugins/petro-seo-images-to-webp/advanced/)

## 评级

尚未提交反馈。

[您的评价](https://wordpress.org/support/plugin/petro-seo-images-to-webp/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/petro-seo-images-to-webp/reviews/)

## 贡献者

 *   [ diegopetroncari ](https://profiles.wordpress.org/diegopetroncari/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/petro-seo-images-to-webp/)