Home / admin / Add support for SVG inside WordPress Media Uploader
  • How to Add support for SVG inside WordPress Media Uploader

    add-support-for-svg-inside-wordpress-media-uploader

    Adding this snippet to the functions.php of your wordpress theme will add support for uploading SVG inside Wordpress Media Uploader. It is important to consider risk when uploading SVG as it is an XML file. Keep security in mind and don’t allow just anyone to upload SVG. You also may want to consider running the Scalable Vector Graphics (SVG) plugin if you have any concerns.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    function wps_mime_types( $mimes ){
        $mimes['svg'] = 'image/svg+xml';
        return $mimes;
    }
    add_filter( 'upload_mimes', 'wps_mime_types' );
    

    ( WordPress codex functions, hooks, in this snippet. )

    upload_mimes, add_filter, wp,