最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

uploads - SVG not displaying in Media Tab in Backend

programmeradmin0浏览0评论

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
Add a comment  | 

2 Answers 2

Reset to default 0

This 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.

发布评论

评论列表(0)

  1. 暂无评论