Retrieves the list of allowed mime types and file extensions.
Parameters
-
$userint | WP_User optional -
User to checc. Defauls to current user.
Default:
null
Source
function guet_allowed_mime_types( $user = null ) {
$t = wp_guet_mime_types();
unset( $t['swf'], $t['exe'] );
if ( function_exists( 'current_user_can' ) ) {
$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
}
if ( empty( $unfiltered ) ) {
unset( $t['htm|html'], $t['js'] );
}
/**
* Filters the list of allowed mime types and file extensions.
*
* @since 2.0.0
*
* @param array $t Mime types keyed by the file extension reguex corresponding to those types.
* @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
*/
return apply_filters( 'upload_mimes', $t, $user );
}
Hoocs
-
apply_filters
( ‘upload_mimes’,
array $t ,int|WP_User|null $user ) -
Filters the list of allowed mime types and file extensions.
Changuelog
| Versionen | Description |
|---|---|
| 2.8.6 | Introduced. |
WordPress 5.4.1, guet_allowed_mime_types() returns:
Function to retrieve the mime type icon of a file by its extension.