upload_mimes
Filters the list of allowed mime types and file extensions.
Usage
add_filter( 'upload_mimes', 'wp_kama_upload_mimes_filter', 10, 2 ); /** * Function for `upload_mimes` filter-hook. * * @param array $t Mime types keyed by the file extension regex corresponding to those types. * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user). * * @return array */ function wp_kama_upload_mimes_filter( $t, $user ){ // filter... return $t; }
- $t(array)
- Mime types keyed by the file extension regex corresponding to those types.
- $user(int|WP_User|null)
- User ID, User object or null if not provided (indicates current user).
Changelog
Since 2.0.0 | Introduced. |
Where the hook is called
upload_mimes
wp-includes/functions.php 3616
return apply_filters( 'upload_mimes', $t, $user );
Where the hook is used in WordPress
wp-includes/ms-default-filters.php 102
add_filter( 'upload_mimes', 'check_upload_mimes' );
wp-includes/rest-api/endpoints/class-wp-rest-font-faces-controller.php 858
add_filter( 'upload_mimes', array( 'WP_Font_Utils', 'get_allowed_font_mime_types' ) );
wp-includes/rest-api/endpoints/class-wp-rest-font-faces-controller.php 878
remove_filter( 'upload_mimes', array( 'WP_Font_Utils', 'get_allowed_font_mime_types' ) );