WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/upload mimes

Description

Add or remove allowed mime types and file extensions.

Usage

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' );

Parameters

(array) 
Current array of mime types.

Return Values

(array) 
Updated array of mime types.

Change Log

Source File

upload_mimes is located in wp-includes/functions.php.

Related

This article is marked as in need of editing. You can help Codex by editing it.