Sorry, this file type is not permitted for security reasons.
上传 svg 图片结果出现这种问题,感觉挺烦的。
把这一段添加到主题的 functions.php 功能文件里面:
// Add this to the functions.php file of your WordPress theme
// It filters the mime types using the upload_mimes filter hook
// Add as many keys/values to the $mimes Array as needed
function my_custom_upload_mimes($mimes = array()) {
// Add a key and value for the SVG file type
$mimes['svg'] = "text/svg";
return $mimes;
}
add_action('upload_mimes', 'my_custom_upload_mimes');