WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 141 | * |
| 142 | * Developers can use this filter to enable uploads of certain image types. By default image types that are not |
| 143 | * supported by the server are prevented from being uploaded. |
| 144 | * |
| 145 | * @since 6.8.0 |
| 146 | * |
| 147 | * @param bool $check_mime Whether to prevent uploads of unsupported image types. |
| 148 | * @param string|null $mime_type The mime type of the file being uploaded (if available). |
| 149 | */ |
| 150 | $prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, isset( $files['file']['type'] ) ? $files['file']['type'] : null ); |
| 151 | |
| 152 | // If the upload is an image, check if the server can handle the mime type. |
| 153 | if ( |
| 154 | $prevent_unsupported_uploads && |
| 155 | isset( $files['file']['type'] ) && |
| 156 | str_starts_with( $files['file']['type'], 'image/' ) |
| 157 | ) { |
| 158 | // Check if the image editor supports the type. |
| 159 | if ( ! wp_image_editor_supports( array( 'mime_type' => $files['file']['type'] ) ) ) { |