Monday, November 30, 2020
Home Blogging How to Add Additional File Types to be Uploaded in WordPress

How to Add Additional File Types to be Uploaded in WordPress

For higher safety, WordPress means that you can solely add probably the most generally used file types. You may add generally used picture codecs, audio/video, and paperwork utilizing the default media uploader. However in the event you wished to add a file sort that isn’t allowed? On this article, we’ll present you tips on how to add further file types to be uploaded in WordPress.

File Sorts Allowed for Add in WordPress

WordPress means that you can add most typical picture recordsdata, audio/ video, PDF, Microsoft workplace and OpenOffice paperwork. WordPress codex has a full checklist of allowed file types  and extensions.

Including Exceptions for Extra File Sorts

Safety is the primary purpose behind the limitation on file types that customers can add. Nevertheless, this doesn’t imply that customers can not change this. Utilizing a tiny little bit of code, you may add a brand new file sort and extension to the WordPress.

For instance, add this code in your theme’s features.php file or a site-specific plugin to permit SVG file sort to be uploaded:

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

Discover that the file extension goes as the important thing in $mime_types related array and the mime sort goes as its worth.

On this instance, svg file extension represents recordsdata with the mime sort picture/svg+xml. You’ll find out mime kinds of a number of widespread file extensions on this web page.

You may as well add a number of file types in a single code snippet, like this:

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

 

You May Also Like : How to Add Nofollow Links in WordPress Navigation Menus

We hope this text helped you learn to enable further file types to be uploaded in WordPress. You might also need to check out tips on how to enhance most file add measurement in WordPress.

If you liked this article, make sure to hit the bell for getting our latest updates and share this article with your friends in every social media platforms.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

How to Signup for Godaddy Affiliate Program & Start Making Money

GoDaddy is likely one of the well-liked model names out there of area and web-hosting. They are well-liked for a numerous cause, and so they...

How To Start Selling Website on Flippa: A Beginner’s Guide To Success

If you may have been working on-line for lengthy and into Website flipping, Flippa is one identify that you need to have heard of. Flippa is a...

How to Fix Your Connection is Not Private Error (Site Owners Guide)

Are you seeing ‘Your connection is not private’ error in your WordPress web site? This is the error message you’ll see on Google Chrome. The...

How to Fix the WordPress White Page of Death (Step by Step)

The WordPress white page of dying is one of the most widespread WordPress errors. It can also be one of the most irritating ones as...

Recent Comments