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
153            *
154            * Developers can use this filter to enable uploads of certain image types. By default image types that are not
155            * supported by the server are prevented from being uploaded.
156            *
157            * @since 6.8.0
158            *
159            * @param bool        $check_mime Whether to prevent uploads of unsupported image types.
160            * @param string|null $mime_type  The mime type of the file being uploaded (if available).
161            */
162           $prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, isset( $files['file']['type'] ) ? $files['file']['type'] : null );
163
164           // If the upload is an image, check if the server can handle the mime type.
165           if (
166                $prevent_unsupported_uploads &&
167                isset( $files['file']['type'] ) &&
168                str_starts_with( $files['file']['type'], 'image/' )
169           ) {
170                // List of non-resizable image formats.
171                $editor_non_resizable_formats = array(