svg and wordpress :: 2018-06-09 14:10:13

If you don’t add support via the functions.php file (“upload_mimes action hook”) we won’t e able to access/upload svg files through the media api

function add_additional_mimestypes_support( array $mimestypes ) {
// add your extension to the array
$mimestypes['vcf'] = 'text/x-vcard';
$mimestypes['svg'] = 'image/svg+xml'; 
return $mimestypes;
}add_filter('upload_mimes', 'add_additional_mimestypes_support');

embed the SVG URL

<div id="div_object_logo_svg" class="svg-container">
<object class="emb" data="<?php echo plugins_url( ‘/images/fist-logo.svg?t=’.date(‘His’) ); ?>" type="image/svg+xml" id="logoSVG" width="100%" height="auto"></object>
<!– div class="svg-container" –>

«