WordPress / WordPress/performance
Use WebP image in templates
@felixarntz is already working on this.
Since Sep 14, 2022.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.