Checks whether client-side media processing is enabled.
Description
Client-side media processing uses the browser’s capabilities to handle tasks like image resizing and compression before uploading to the server.
Source
function wp_is_client_side_media_processing_enabled(): bool {
// This is due to SharedArrayBuffer requiring a secure context.
$host = strtolower( (string) strtok( $_SERVER['HTTP_HOST'] ?? '', ':' ) );
$enabled = ( is_ssl() || 'localhost' === $host || str_ends_with( $host, '.localhost' ) );
/**
* Filters whether client-side media processing is enabled.
*
* @since 7.1.0
*
* @param bool $enabled Whether client-side media processing is enabled. Default true if the page is served in a secure context.
*/
return (bool) apply_filters( 'wp_client_side_media_processing_enabled', $enabled );
}
Hooks
- apply_filters( ‘wp_client_side_media_processing_enabled’,
bool $enabled ) Filters whether client-side media processing is enabled.
Changelog
| Version | Description |
|---|---|
| 7.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.