I addes this code to allow SVG Uploads to the Media Library of wordpress:
function upload_svg ( $svg_mime ){
$svg_mime['svg'] = 'image/svg+xml';
return $svg_mime;
}
add_filter( 'upload_mimes', 'upload_svg' );
define('ALLOW_UNFILTERED_UPLOADS', true);
Than I added some SVGs to the Media Library. Using them works perfectly fine. The only Issue I have is that they will not be displayed in the Media Library. On other Pages in the Backend they display fine.
Is there anything I can do to display them in the Media Tab aswell? I couln't find anything online on how to fix this issue.
I addes this code to allow SVG Uploads to the Media Library of wordpress:
function upload_svg ( $svg_mime ){
$svg_mime['svg'] = 'image/svg+xml';
return $svg_mime;
}
add_filter( 'upload_mimes', 'upload_svg' );
define('ALLOW_UNFILTERED_UPLOADS', true);
Than I added some SVGs to the Media Library. Using them works perfectly fine. The only Issue I have is that they will not be displayed in the Media Library. On other Pages in the Backend they display fine.
Is there anything I can do to display them in the Media Tab aswell? I couln't find anything online on how to fix this issue.
Share Improve this question asked Oct 15, 2020 at 16:12 NiqqlNiqql 534 bronze badges 1- 1 The solution is lengthy. Here's an external link: sitepoint/wordpress-svg – cjbj Commented Oct 19, 2020 at 10:18
2 Answers
Reset to default 0This is the solution to allow SVG upload and preview to Media area of WordPress: https://gist.github/benfrain/9422862
Try to use this plugin: https://wordpress/plugins/wp-extra-file-types/. I use it and .svg files seems fine in media lib.