apply_filters( 'mime_types', string[] $wp_get_mime_types )

Filters the list of mime types and file extensions.


Description Description

This filter should be used to add, not remove, mime types. To remove mime types, use the ‘upload_mimes’ filter.


Top ↑

Parameters Parameters

$wp_get_mime_types

(string[]) Mime types keyed by the file extension regex corresponding to those types.


Top ↑

Source Source

File: wp-includes/functions.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
3.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Lovro Hrust

    Add Webp image type to allowed media types. Note that this type may still not display correctly in media library, since its dimensions might be incorrectly read by image processing functions.

    /**
     * Add webp to allowed media types
     */
    function wpdocs_add_webp( $wp_get_mime_types ) {
    	$wp_get_mime_types['webp'] = 'image/webp';
    	return $wp_get_mime_types;
    }
    
    add_filter( 'mime_types', 'wpdocs_add_webp' );
    

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