WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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;
share|improve this answer
Thanks for the code snippet, but it's not a plugin. I was specifically asking for a plugin. – Sebastian Krysmanski Oct 5 '12 at 11:16
You can easily make that a plug-in... – Joseph Leedy Oct 5 '12 at 12:10
@SebastianKrysmanski This is a plugin. Just add the common plugin header and save it as a separate file in your plugin directory. Plain plugin recommendation questions are off topic here, we deal with code solutions only. :) – toscho Oct 6 '12 at 13:22
Boom. Now it's a plugin. lol – Brian Fegter Oct 7 '12 at 1:51
Yep, this doesn't work. I can't downvote though. – Adam Oct 22 '14 at 9:30

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

share|improve this answer
This is the Core way of doing it. +1 – Patrik Alienus Dec 22 '14 at 20:30
Confirmed to work in Wordpress 4.1 as well! – Joel Purra Jan 14 '15 at 13:46
up vote 1 down vote accepted

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);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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