Menu Adam R Brown

WP hooks navigation: Home/browse • Actions index • Filters index

Source View: wp_prevent_unsupported_mime_type_uploads

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
2189      if (
2190           wp_is_mobile() &&
2191           str_contains( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) &&
2192           str_contains( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' )
2193      ) {
2194           $plupload_init['multi_selection'] = false;
2195      }
2196
2197      /** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php */
2198      $prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, null );
2199
2200      if ( $prevent_unsupported_uploads ) {
2201           // Check if WebP images can be edited.
2202           if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
2203                $plupload_init['webp_upload_error'] = true;
2204           }
2205
2206           // Check if AVIF images can be edited.
2207           if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/avif' ) ) ) {