wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes
get_allowed_mime_types › WordPress Function
Depuis2.8.6
Dépréciéen/a
› get_allowed_mime_types ( $user = null )
| Paramètres: |
|
| Retourne: |
|
| Défini(e) dans: |
|
| Codex: |
Retrieves the list of allowed mime types and file extensions.
Fonctions en relation: get_allowed_block_types, get_post_mime_types, get_allowed_themes, get_available_post_mime_types, get_post_mime_type
Source
function get_allowed_mime_types( $user = null ) {
$t = wp_get_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<string, string> $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 apply_filters( 'upload_mimes', $t, $user );
}