MainWP Community

Enable SVG upload in WordPress

Enable SVG upload in WordPress on your child site.

Snippet Type

Execute on Child Sites

Snippet

function smartwp_enable_svg_upload( $mimes ) {
  //Only allow SVG upload by admins
  if ( !current_user_can( 'administrator' ) ) {
    return $mimes;
  }
  $mimes['svg']  = 'image/svg+xml';
  $mimes['svgz'] = 'image/svg+xml';
  
  return $mimes;
}
add_filter('upload_mimes', 'smartwp_enable_svg_upload');
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.