SEO Grimsby News – Uploading Different File Types In WordPress

Posted By on December 29, 2014, in SEO Grimsby News

How To Add Different File Types To WordPress

For added security when using WordPress, you are  only allowed to upload commonly used file types.

Using the Default Uploader, you can upload common image formats(e.g, jpeg, .gif or .png), audio/video, and documents.

You can also upload other file types too.

Let’s show you how to add file types to WordPress.

file-types-not-allowed

Aditional File Type Exceptions

Security is the main factor behind the limitation on file types that can be uploaded.

The good news is, it does not mean that you cannot change this rule.

If you want to add more file types to the list, and you are not adverse to a little coding, you can add a new file type and extension to WordPress.

Like this:

  1. function my_myme_types($mime_types){
  2.     $mime_types['svg'] = 'image/svg+xml'; //Adding svg extension
  3.         return $mime_types
  4. }
  5. add_filter('upload_mimes', 'my_myme_types', 1, 1);

You should see that the file extension goes as the key in $mime_types associated array and the mime type goes as its value.

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

If you choose too, you can add multiple file types in one piece of code.

  1. function my_myme_types($mime_types){
  2.         $mime_types['svg'] = 'image/svg+xml'; //Adding svg extension
  3. $mime_types['psd'] = 'image/vnd.adobe.photoshop'; //Adding photoshop files
  4. return $mime_types;
  5. }
  6. add_filter('upload_mimes', 'my_myme_types', 1, 1);

Hopefully, this has given you an insight in how to change the file types that WordPress allows.

SEO Grimsby

SEO Grimsby is a dedicated service to help Grimsby business get the most out of the web, through SEO enhancing web pages you can lift your websites ranking with Google and other search engines. Customers are looking for your service now, SEO Grimsby can put you in-front of them.

>> Make Contact

About Anthony

Anthony Brewitt is Design Bit, has been for years - he's an experienced WordPress Designer, and Muggle-born Marketing Philosopher. Let’s talk about your website; your marketing, blog design, and that cool new mobile web thingy.