upload_mimes
mediaFilters the list of file types allowed for upload
upload_mimes controls what get_allowed_mime_types() and the uploader accept — adding a type here does not make it safe by itself; WordPress still runs its own file-content checks.
Signature
apply_filters( 'upload_mimes', array $mime_types, WP_User|int|null $user );Example
add_filter( 'upload_mimes', function( $mimes ) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
} );Common Use Cases
- Allow SVG or other blocked file types
- Restrict uploads to a smaller set of types by role
- Add support for a niche file format





