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:

svg-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.

Originally published on

Leave a Reply

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

Have Any Questions?

Speak with a
Digital Expert

  • Looking to increase leads?
  • Maximize profits?
  • Redesign your website?
  • Sell Online?
  • Build an App?

Let's Discuss Your Next Project

  • This field is for validation purposes and should be left unchanged.