Allow SVG Uploads to the WordPress Media Library

Topic WordPress, Design
Access FTP, WP-Admin

SVGs are increasing in popularity but they’re still disallowed by WordPress out-of-the-box. There is an active discussion on this and we imagine SVGs will be able to be uploaded through the media library soon (although we thought that years ago). You can reference the discussion here which covers some security concerns but the but the general consensus among WordPress professionals is that it’s time. Until WordPress decides it’s time, here is a snippet of code to get you working with SVGs on WordPress.

Navigate to your functions.php file and add this snippet:

//Allow SVG Uploads via Media Library --- CJM MAY 2016
function allow_svgimg_types($mimes) {
  $mimes['svg'] = 'image/svg+xml';
  return $mimes;
add_filter('upload_mimes', 'allow_svgimg_types');

Save and you’re good to go!

Questions or Comments

Notify of

Quick Open Ticket

You can quickly open a ticket without logging in. Be sure to use your login email address and include the web address of your service.