apply_filters( ‘post_mime_types’, array $post_mime_types )

Filters the default list of post mime types.

Parameters

$post_mime_typesarray
Default list of post mime types.

Source

return apply_filters( 'post_mime_types', $post_mime_types );

Changelog

VersionDescription
2.5.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    To unset and rename some items in the dropdown filter for media items:

    function edit_post_mime_types($post_mime_types){
        $post_mime_types['application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-word.document.macroEnabled.12,application/vnd.ms-word.template.macroEnabled.12,application/vnd.oasis.opendocument.text,application/vnd.apple.pages,application/pdf,application/vnd.ms-xpsdocument,application/oxps,application/rtf,application/wordperfect,application/octet-stream'][0] = 'PDFs';   // Change Documents to PDFs only; 
        unset($post_mime_types['audio']); // Remove Audios
        unset($post_mime_types['video']); // Remove Videos
        unset($post_mime_types['application/x-gzip,application/rar,application/x-tar,application/zip,application/x-7z-compressed']); // Remove Archives
        unset($post_mime_types['application/vnd.apple.numbers,application/vnd.oasis.opendocument.spreadsheet,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel.sheet.macroEnabled.12,application/vnd.ms-excel.sheet.binary.macroEnabled.12']); // Remove Spreadsheets
    
        return $post_mime_types;
    }
    
    add_filter('post_mime_types', 'edit_post_mime_types');

    I had to resort to this because apparently, restricting all these file types using upload_mimes filter still doesn’t remove these items in the dropdown.

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