I'm using Wordpress 3.4.2 for a private blog, i.e. one on which only I can post. Now, Wordpress prevents me from uploading certain file types (like C# source files). As far as I understand it, there's a white-list that defines what can be uploaded.

Is there a plugin that can extend - or better, even disable - this white-list?

All other answers tell me I should edit my theme but I'd rather have a plugin for that (so that I don't need to edit all my themes).

Also, I found this plugin but, again, it requires me to edit some file on my server (that's probably overwritten when the plugin is updated).

So, is there anything else?


You can create a plugin or add this to the config file, but for 3.9.2 this worked for me.

| improve this answer | |
  • This is the Core way of doing it. +1 – Athoxx Dec 22 '14 at 20:30
  • 2
    Confirmed to work in Wordpress 4.1 as well! – Joel Purra Jan 14 '15 at 13:46
  • This, in wp-config.php. I really don't understand why it isn't the default, at least for administrators. – Guntram Blohm supports Monica Jun 2 '16 at 20:19

Filter 'user_has_cap' and set 'unfiltered_upload' to 1.

Sample code not tested:

Plugin Name: Remove Uploads Filter
Plugin URI: http://wordpress.stackexchange.com/questions/67225/allow-all-file-types-for-upload
Description: Disables white-list filter for uploads
Version: 1.0
Author: WPSE - @toscho

add_filter( 'user_has_cap', 'wpse_67225_unfiltered_upload' );

function wpse_67225_unfiltered_upload( $caps )
    $caps['unfiltered_upload'] = 1;
    return $caps;
| improve this answer | |

Unfortunately, toscho's answer doesn't work - at least not in Wordpress 3.4 and above.

The correct solution is the following:

# For this, see: wp-includes/capabilities.php > map_meta_cap()
function wpse_6533_map_unrestricted_upload_filter($caps, $cap) {
  if ($cap == 'unfiltered_upload') {
    $caps = array();
    $caps[] = $cap;

  return $caps;

add_filter('map_meta_cap', 'wpse_6533_map_unrestricted_upload_filter', 0, 2);
| improve this answer | |
  • Hi, where should I put the code above? Will it work if I put it on my functions.php? – leonardeveloper Aug 4 '16 at 9:36
  • @LeonardDrapeza Yes, you can put it in functions.php of your theme. But then, this will only work as long as your theme is active AFAIK. – Sebastian Krysmanski Aug 4 '16 at 9:39
  • This doesn't work either. – Jim Maguire Feb 23 '17 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.