wordpress snippets

Upload SVG to WordPress

Last modified: November 5, 2018

Add the above function to your functions.php file and you will be able to add SVG files to the WordPress media.

function add_svg_to_upload_mimes( $upload_mimes ) {
  $upload_mimes['svg'] = 'image/svg+xml';
  $upload_mimes['svgz'] = 'image/svg+xml';
  return $upload_mimes;
}
add_filter( 'upload_mimes', 'add_svg_to_upload_mimes', 10, 1 );

 

Save 4 Later
Email these links to yourself