apply_filters( 'upload_mimes', array $t, int|WP_User|null $user )

Filters list of allowed mime types and file extensions.


Description Description


Parameters Parameters

$t

(array) Mime types keyed by the file extension regex corresponding to those types. 'swf' and 'exe' removed from full list. 'htm|html' also removed depending on '$user' capabilities.

$user

(int|WP_User|null) User ID, User object or null if not provided (indicates current user).


Top ↑

Source Source

File: wp-includes/functions.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Mahesh Waghmare

    Add MIME types.

    function my_custom_mime_types( $mimes ) {
    	
    	// New allowed mime types.
    	$mimes['svg']  = 'image/svg+xml';
    	$mimes['svgz'] = 'image/svg+xml';
    	$mimes['doc']  = 'application/msword'; 
    
        // Optional. Remove a mime type.
        unset( $mimes['exe'] );
    
    	return $mimes;
    }
    
    add_filter( 'upload_mimes', 'my_custom_mime_types' );
    

You must log in before being able to contribute a note or feedback.