Add SVG file upload support in WordPress

By default WordPress does not allows it users to upload SVG file for the security reason. It generates an error message while we are trying to upload a SVG file.

But, you might be needed to upload SVG files for your site. By adding the following lines of code into the currently activated theme 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

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Comment

Back To Top