By default you cannot upload SVG images to the media library in WordPress as this format is not allowed by default. SVG which stands for Scalable Vector Graphics is not a new format but been around since 1999, but has taken time to be adopted by web standards and various browsers.

Now it can be safely used across all devices/browsers except the less than impressive Internet Explorer < 8 – which is now accounting for 1.58% global usage.

Whats great about SVG is its vector format structure which makes it ideal for logos and flat art imagery which will look 100% sharp at any resolution.

Adobe Illustrator can ‘Save as…’ to SVG with the SVG 1.1 being a generally accepted and safe profile.

So you can use the WordPress mime_types filter to add in this format by adding a code snippet in your functions.php file

View the code on Gist.

One of the pain points is that if you add an image via the post editor it will display the weight and height as ‘1’ and therefore not visible on the front end, you will need to declare the width and height values for those attributes.

Ref and Ref

 

Share:

Leave a Reply