I'm not strong in WP programming, bu I try to understand what to do to enable SVG in my site. I found that in need to add function below to functions.php
:
/**
* Add SVG capabilities
*/
function wpcontent_svg_mime_type( $mimes = array() ) {
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';
return $mimes;
}
add_filter( 'upload_mimes', 'wpcontent_svg_mime_type' );
wpcontent
should be replaced with namespace. But how to know what is my WP namespace?
Add lines below to .htaccess
file after the line, #End WordPress
:
# Add SVG Mime Types
AddType image/svg+xml svg
AddType image/svg+xml svgz
Is anything else I shoud do?
UPD. After this procedure iI have following:
Now I can upload files to Media, but no preview. And when I do insert nothing happens - no new picture.
How to solve this?
tomjn_
, but I could have prefixed withmoomins_
orcup_of_tea_
, so long as they're unique to my code it doesn't matter