wp_prevent_unsupported_mime_type_uploads

wp_prevent_unsupported_mime_type_uploads

Hook Type: filter

See hook in core

Displaying hooks found in version: wordpress-6.8.2

apply_filters('wp_prevent_unsupported_mime_type_uploads') is found 2 times:

  • /wp-admin/includes/media.php line 2198
    		$plupload_init['multi_selection'] = false;
    	}
    
    	/** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php */
    	$prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, null );
    
    	if ( $prevent_unsupported_uploads ) {
    		// Check if WebP images can be edited.
    		if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
    			$plupload_init['webp_upload_error'] = true;
    		}
    
  • /wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php line 150
    		 *
    		 * @param bool        $check_mime Whether to prevent uploads of unsupported image types.
    		 * @param string|null $mime_type  The mime type of the file being uploaded (if available).
    		 */
    		$prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, isset( $files['file']['type'] ) ? $files['file']['type'] : null );
    
    		// If the upload is an image, check if the server can handle the mime type.
    		if (
    			$prevent_unsupported_uploads &&
    			isset( $files['file']['type'] ) &&
    			str_starts_with( $files['file']['type'], 'image/' )