<?php //Enable SVG upload 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');