[wp-trac] [WordPress Trac] #52867: Use WebP as default format for image sub-sizes (when available).
WordPress Trac
noreply at wordpress.org
Mon Mar 29 20:58:25 UTC 2021
#52867: Use WebP as default format for image sub-sizes (when available).
--------------------------------------+-----------------------------
Reporter: adamsilverstein | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Media | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------------
Comment (by adamsilverstein):
[attachment:"52867.2.diff"] is the (renamed) filter part only of this
patch. This filters lets developers set the default output format (mime
type) and this would enable creating a simple plugin users could run to
enable WebP (or any other format) as their default output format. Naming
suggestions welcome!
Having a plugin available would enable much wider testing of the feature.
Testing:
To save uploaded jpeg images as WebP by default, add this to your
codebase:
{{{
add_filter( 'wp_image_editor_output_format', function( $formats ) {
$formats['image/jpg'] = 'image/webp';
return $formats;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52867#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list