Categories

Featured templates

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

George Jones July 27, 2015
Rating: 5.0/5. From 1 vote.
Please wait...

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

Highly Customizable Wordpress Themes
This entry was posted in WordPress Tutorials and tagged allowed, file, type, upload, WordPress. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket