How to allow additional file type uploads in WordPress

AppIcon76x76@2xYou can upload a lot with the WordPress Media Uploader, but depending on the file extension the system will not allow everything on your server by default – for security reasons. ZIP files and PDFs are fine, but something more obscure – particularly non-standard extensions or executable files – are not. I like it that way too!

One way around this limitation is to simply ZIP up your obscure file and upload the archive – but that’s not always an option. Besides, you may need your file to be openable directly.

In this article I’ll show you how to add additional file extensions to WordPress so that they can be uploaded with the Media Uploader.

Screen Shot 2015-01-07 at 11.54.45


WordPress takes care of allowed file extensions in an array of MIME Types. Those are comprised of a type and a subtype (for example, text/html or image/jpeg). Here’s a list of MIME Types commonly in use:

When in doubt about your file type, text/plain is a good starting point. In this example I’ll add the .brush file extension because I wanted to share some Procreate Brushes, and iPad visitors should be able to open them directly in Procreate when they hit my link.

Adding File Types

We’ll setup a function which adds our file extension to the existing array of mime types, then let WordPress call this function with a filter. Add this code to your theme’s functions.php file, or anywhere in your plugin:

It’s always wise to prefix such functions with your own initials or known prefix (like prefix_allow_personal_uploads). This avoids potential duplicate functions and conflicts with WordPress and existing plugins.

That’s it – .brush files are now allowed by the Media Uploader.

Removing File Types

With the same principle we can also disallow certain file types to be uploaded. For example, GIF files are allowed by default, but we can remove them if we wish:

No more GIF uploads.

Multisite Considerations

To make your new file extensions available on Multisite Installations, you need to add those under Network Admin – Settings – Network Settings – Upload Settings. There’s a text box there with default values, just add yours at the end, separated from the rest with a space:

Screen Shot 2015-01-07 at 12.29.42

No need to remove any here, they simply won’t be allowed when users try to upload extensions you’ve forbidden by using the upload_mimes filter.

Further Reading

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

3 thoughts on “How to allow additional file type uploads in WordPress

  1. Pingback: blogging

Leave a Reply to Bhumi Cancel reply