wp_is_client_side_media_processing_enabled()
Checks whether client-side media processing is enabled.
Client-side media processing uses the browser's capabilities to handle tasks like image resizing and compression before uploading to the server.
Hooks from the function
Returns
bool. Whether client-side media processing is enabled.
Usage
wp_is_client_side_media_processing_enabled(): bool;
Changelog
| Since 7.1.0 | Introduced. |
wp_is_client_side_media_processing_enabled() wp is client side media processing enabled code WP 7.1
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 );
}