Advertisement
miriamdepaula

WordPress: Allow other mime types uploads

Dec 8th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2. //allow to upload swf and exe and...
  3. function UploadOtherMimes ($mimes) {
  4.     if ( function_exists( 'current_user_can' ) )
  5.         $unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
  6.     if ( !empty( $unfiltered ) ) {
  7.         $mimes = array( 'swf' => 'application/x-shockwave-flash',
  8.                 'exe' => 'application/x-msdownload',
  9.                 'zip' => 'multipart/x-zip',            
  10.                 'mp3' => 'audio/x-mpeg' );
  11.     }
  12.     return $mimes;
  13. }
  14. add_filter('upload_mimes','UploadOtherMimes');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement