Skip to content

Only replace content images with additional MIME type version when in a frontend request context by default #379

@adamsilverstein

Description

@adamsilverstein

To help address concerns around WebP compatibility, we should ensure that WebP images are used by default for the content only in the front end (or "template") context.

Critically, when content is filtered outside this context - for example in REST endpoints and RSS feeds, the original mime type should be used by default (ew can leverage the existing filter here to make this customizable). In addition, core functions like wp_get_attachment_image_url which would be used to generate Open Graph tags should always return the original MIME type unless called in the template context.

Some research is needed on the best approach here to ensure template context is recognized and image replacement works in places like widgets or images placed in FSE headers while feeds and REST endpoints remain unaffected. We can possibly leverage template_redirect to ensure we are in the "right" loop.

Metadata

Metadata

Assignees

Labels

[Plugin] Modern Image FormatsIssues for the Modern Image Formats plugin (formerly WebP Uploads)[Type] EnhancementA suggestion for improvement of an existing feature

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions