Skip To Content

Scaleable Vector Graphics Upload Support into WordPress

Development

Kevin Doherty Creative Director

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.

Comments

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

Request a Quote

If you’re ready to change the trajectory of your business and
excited to partner with the right team to get the job done.

UP

© 2024 NVISION. All Rights Reserved.