Back

How to Upload SVG to WordPress: 3 Workable Solutions

Spread the love

WordPress by default doesn’t allow us to upload SVG files to WordPress media library. Are you looking for a way on how to upload SVG to WordPress?

WordPress by default allows you to upload all popular image formats such as JPG, PNG, and WebP, but you cannot add SVG image file format. In this article, we will show you how to upload SVG files to WordPress Media Library.

What exactly is the SVG file format?

SVG stands for Scalable Vector Graphics and is an image format that allows you to create shapes, icons, and text. It’s used by designers and developers to create icons that can be scaled to any size and has a resolution of any resolution. If you want to use SVG in your WordPress website, you’ll need to know how to upload it and what are the best ways to do that!

Why Should You Use WordPress SVG?

There are many benefits to using SVG on WordPress.

Scalability:

SVG is a vector image format, which means that the image is scalable and can be resized to any size. SVG images can also be embedded in emails, blogs, and websites. SVG is one of the best ways to display your site’s logo, brand, or other important images.

Speed Performance:

SVG files make it easier to improve website performance because they take up less web storage space and load much faster than raster images.

SEO Friendly:

SVG files are easily indexed by Google, allowing them to appear in Google Image Search and significantly improve your SEO results.

Using the SVG Support Plugin, upload SVG files to WordPress

 

SVG Support - Upload SVG to WordPress

The SVG Support plugin is a WordPress plugin that allows you to upload SVG files to WordPress and display them as images.

This is a straightforward method that makes use of a plugin that provides full support for adding SVG files to WordPress. It also supports inline SVG in WordPress posts and pages.

To get it to work, first install and activate the SVG Support plugin.

That’s all. You can then upload your SVG images to the WordPress library in the same way that you would upload JPG or PNG images.

The plugin also includes some useful options such as “Restrict to Administrators?” Using this, only the site administrator will be able to upload SVG files to WordPress.

And an advanced mode, which you only need to enable if you want to use advanced features such as CSS animations and inline SVG rendering.

Using the Safe SVG WordPress Plugin, upload SVG to WordPress

Safe SVG - Use SVG files in WordPress

This is yet another plugin that allows you to upload SVG to WordPress while ensuring that they are sanitized to prevent SVG/XML vulnerabilities from affecting your site.

Add WordPress SVG Support by writing custom code

This method entails writing custom code to add support for SVG file formats for uploading to WordPress by using the WordPress filter

'upload_mimes'

Insert the following code into the functions.php file of your active child or parent WordPress theme.

function add_svg_format_to_uploads( $file_types ) {
  $new_filetypes = array();
  $new_filetypes['svg'] = 'image/svg+xml';
  $file_types = array_merge($file_types, $new_filetypes );
  return $file_types;
}
add_filter( 'upload_mimes', 'add_svg_format_to_uploads' );

That’s it.

Conclusion

We hope you enjoyed our article on how to upload SVG to WordPress. We know that there are times when you may want to create SVG graphics on your website, but WordPress by default doesn’t allow it. We have put together 3 workable solutions for those who have reached this point. Please share this post with anyone who may require it and if you have any questions, feel free to leave your comments or questions in the below comment box.

You May also Read

How to add additional file types in WordPress
How to Embed Video in WordPress Blog in less than 10 minutes to increase engagement
How to Fix file and folder permissions problem in WordPress

 

Leave a Reply

Your email address will not be published. Required fields are marked *