WebP not generated/served when “Output fallback images” is enabled

Open
#2,390 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
67/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
php
Domain
backend

Research direction

Reproduce the issue through a WordPress Media Library upload with WebP output and fallback images enabled, then compare the generated files and frontend references with fallback disabled. Trace the upload and frontend-serving paths to find why WebP generation is skipped; done means WebP files are generated and served when fallback images are enabled, while existing fallback behavior remains intact.

Written by the indexing model from the issue text.

Description

[Plugin] Modern Image Formats [Type] Bug

From a support topic by @daltonsutton:

I understand the plugin prefers the original format when it’s smaller than the generated WebP and only uses WebP when it’s smaller. However, with “Output fallback images” enabled, new uploads never generate or serve WebP; only the original format is used on the frontend. If I turn fallback off, WebP is generated and used as expected. I tested many image types and sizes (JPEG and PNG), regenerated thumbnails after changing settings, cleared caches, and toggled “Generate all fallback image sizes.” With fallback enabled, I don’t see a .webp file in uploads and the frontend never references .webp; with fallback disabled, I see the WebP output working.

Environment: WordPress 6.8.2, Modern Image Formats 2.6.1, PHP 7.4.33 (apache2handler), single-site, production. Imagick is active (WP_Image_Editor_Imagick; ImageMagick 6.9.10-97; imagick 3.7.0); GD also present. AVIF not available.

Reproduction: set output format to WebP, enable fallback images, upload a JPEG that should compress well, insert it into a post, and view the frontend—only .jpg is referenced and no .webp is created. I also don’t see WebP generated when uploading directly to the Media Library. Disabling fallback and repeating the same steps generates and serves WebP as expected.

The generation for WebP is being skipped entirely when fallback is on no matter what image type or size I use. Is this a known issue with fallback enabled? Thanks!

Dominant language
PHP
Stars
461
Forks
165
Avg merge
11h 12m
Merged PRs (30d)
28

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from WordPress/performance

All issues in WordPress/performance

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.