Add SVG file upload support in WordPress

By default, WordPress does not allow its users to upload SVG files for security reasons. It generates an error message while we are trying to upload an SVG file.

But, you might need to upload SVG files for your site. By adding the following lines of code into the currently activated theme’s function.php file, you can easily allow WordPress to upload SVG files. Here goes the code.

function sharai_khana_mime_types($mimes) {
   $mimes['svg'] = 'image/svg+xml';
   return $mimes;
}
add_filter('upload_mimes', 'sharai_khana_mime_types');

I hope that helps you. Please add your comment or feedback if you have any specific questions.

Total 0 Votes
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Comment

Back To Top
Cool Ajax - Web Development Tutorial Blog
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.