If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

WordPress. How to add additional allowed file types to be uploaded

This video tutorial is going to show how to add additional file types to be uploaded in WordPress.

WordPress. How to add additional allowed file types to be uploaded

  1. Log into WordPress admin panel, then go to Media -> Add New and try to upload audio/ac3, video/x-flv or image/svg+xml file types:

    WordPress-How to add additional file types to be uploaded-1

  2. When uploading is done, you will get a message ‘Has failed to upload due to an Error. Sorry this file type is not permitted for security reasons’:

    WordPress-How to add additional file types to be uploaded-2

  3. To fix that, navigate to Appearance -> Editor, open custom-function.php file:

    WordPress-How to add additional file types to be uploaded-3

  4. Add the following function into the bottom of your custom-functions.php file to allow WordPress uploading additional mime types.

      add_filter('upload_mimes','add_custom_mime_types');
    	function add_custom_mime_types($mimes){
    		return array_merge($mimes,array (
                'svg' => 'image/svg+xml'
    		));
    	}  
      

    WordPress-How to add additional file types to be uploaded-4

  5. Notice that the file extension goes as the key in $mime_types associated array and the mime type goes as its value.

    In this example, svg file extension represents files with the mime type image/svg+xml.

    You can find out mime types of several common file extensions on this page.

  6. Go back to Media Library and try to upload image/svg file again:

    WordPress-How to add additional file types to be uploaded-5

Feel free to check the detailed video tutorial below:

WordPress. How to add additional allowed file types to be uploaded