Modify Allowed Upload Mime Types

This snippet let’s you add or remove allowed file types in the WordPress upload popup. Adding font files like .woff are not allowed by default and this fixes that.

Code Snippet:

function edit_upload_types($existing_mimes = array()) {
    // allow .woff
    $existing_mimes['woff'] = 'font/woff';

    // add as many as you want with the same syntax

    // disallow .jpg files
    unset( $existing_mimes['jpg'] );

    return $existing_mimes;
add_filter('upload_mimes', 'edit_upload_types');

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!