Skip to content

Consider also replacing JPEG images with WebP images in img tags controlled by code #523

@felixarntz

Description

@felixarntz

Feature Description

Related to #155 (and raised again by PR #517): While it probably makes sense to add a MIME type parameter to the relevant image core functions as described in #155, this doesn't mean that we should rely solely on the plugin and theme developers to use WebP.

Since the current behavior is to replace JPEG images with WebP images in post content img tags, potentially we could also do the same in other img tags which would be used in the frontend. I think that this would fall under the same considerations, e.g. as long as it's purely within img tags, we should be fine since those are definitely user-facing HTML in the frontend, within the body. In other words, we could by default adjust the output of wp_get_attachment_image() (which outputs an img tag) but not the one of e.g. wp_get_attachment_image_src() or wp_get_attachment_image_url() (which only return URL etc., but not necessarily for use in an img tag).

Special cases where this is not desired already right now would have to unhook the content replacement filter, so if we added one more filter somewhere else, they would simply need to remove that too, so not a notable overhead.

Let's think about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Plugin] Modern Image FormatsIssues for the Modern Image Formats plugin (formerly WebP Uploads)[Type] BugAn existing feature is broken

    Type

    No type

    Projects

    Status

    To Do 🔧

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions