SVG image is good for previewing graphic content. It preserver all the graphics quality. So for showing good quality graphics, we need to upload the SVG image. But by default, if we try to upload an SVG file then it shows a security error. So to upload this we need to enable SVG file upload for this. There are many plugins to enable this. Here are the simple steps to enable SVG in WordPress.

You can enable the SVG image in WordPress without a plugin by a simple trick. In your theme folder, edit your functions.php and add the below code.

function add_file_types_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_file_types_to_uploads');

Why SVG is important in WordPress?

Scalable Vector Graphics (SVG) is a file format that defines vector-graphics using the XML. The main benefit of SVG is that it allows you to enlarge images without losing quality or having any pixelation.

This enables you to enlarge vector graphics without losing any quality. Most importantly, SVG images are smaller in filesize than JPEGs or PNG.

How to add a nav menu in WordPress, learn from WordPress tutorials.

Hope this article was helpful for you. If so, please share this article.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorial playlist. You can also find us on Twitter and Facebook.

Useful Tags :