Scaleable Vector Graphics (SVG) is all the praise in a modern developer’s toolkit these days. Most modern browsers these days offer full support and we’re finally transitioning into a somewhat balanced browsersphere and not having to provide fall back after falling back.
Uploading Scaleable Vector Graphics into WordPress
The first time I tried to upload and .svg into WordPress I was greeted by this lovely error:
The Code Fix
To overcome this speed bump, simply add this to your theme’s functions.php
file.
function add_mime_types( $mimes ){ $mimes['svg'] = 'image/svg+xml'; return $mimes; } add_filter( 'upload_mimes', 'add_mime_types' );
Pretty simple fix and now you can add Scaleable Vector Graphics graphics to your site.