[wp-trac] [WordPress Trac] #64876: Media: add filter on client-side supported MIME types
WordPress Trac
noreply at wordpress.org
Tue Mar 17 16:26:18 UTC 2026
#64876: Media: add filter on client-side supported MIME types
-----------------------------+--------------------
Reporter: adamsilverstein | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 7.1
Component: Media | Version: trunk
Severity: normal | Keywords:
Focuses: |
-----------------------------+--------------------
== Description
Currently, the list of MIME types supported by client-side media
processing (via WebAssembly-based vips) is hardcoded. This makes it
impossible for plugins to add support for additional formats or restrict
processing to a subset of formats.
This ticket adds a `client_side_supported_mime_types` filter that allows
plugins to customize which image formats are processed client-side. The
filtered list is exposed via the REST API root index endpoint (for users
with the `upload_files` capability) and consumed by the JavaScript upload
media store.
=== Changes
**REST API (class-wp-rest-server.php)**
- Add `client_side_supported_mime_types` field to the REST API root index
response
- Add `client_side_supported_mime_types` filter with default value:
`['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/avif']`
- Only exposed when `current_user_can( 'upload_files' )`
**Preload paths (edit-form-blocks.php, site-editor.php)**
- Add `client_side_supported_mime_types` to the preloaded root fields list
in both the post editor and site editor
- Required so the preloaded URL matches the JavaScript request, avoiding
an extra fetch on editor load
=== Example usage
```php
// Remove AVIF from client-side processing.
add_filter( 'client_side_supported_mime_types', function ( $mime_types ) {
return array_diff( $mime_types, array( 'image/avif' ) );
} );
```
```php
// Add HEIC to client-side processing.
add_filter( 'client_side_supported_mime_types', function ( $mime_types ) {
$mime_types[] = 'image/heic';
return $mime_types;
} );
```
== Props
adamsilverstein
== Related
- Gutenberg PR: https://github.com/WordPress/gutenberg/pull/76549
- Core PR: https://github.com/WordPress/wordpress-develop/pull/11277
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64876>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list