WordPress / WordPress/performance

Use WebP image in templates

Open
#513 3 comments 0 reactions 2 assignees View on GitHub

@felixarntz is already working on this.

Since Sep 14, 2022.

[Plugin] Modern Image Formats [Plugin] Performance Lab [Type] Enhancement Needs Discussion
Dominant language
PHP
Stars
461
Forks
165
Avg merge
11h 12m
Merged PRs (30d)
28

Description

A couple of support tickets have been raised regarding using the WebP version of images in templates.

Currently, the plugin replaces images URLs to their WebP version in the WordPress content only.

Providing a way to use WebP outside of the content has been explored as part of a core patch (#155) but has been paused due to feedback on the wider WebP core patch.

As an initial step towards supporting WebP across templates, we could use hooks to modify the returned URL by core functions. As a starting point we can explore using the wp_get_attachment_image_src hook.

This could be optional by providing a custom filter in the plugin to allow developers to enable WebP support outside of the content. The filter could accept an array to provide more granular control over what image sizes should be returned as WebP if needed.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.