开启svg文件上传

Published
2022-12-12
浏览次数 :  23

在functions.php添加

function enable_svg_upload( $upload_mimes ) {

    $upload_mimes['svg'] = 'image/svg+xml';

    $upload_mimes['svgz'] = 'image/svg+xml';

    return $upload_mimes;

}

add_filter( 'upload_mimes', 'enable_svg_upload', 10, 1 );

在wp-config.php添加

define('ALLOW_UNFILTERED_UPLOADS', true);


  • 标签1
  • 标签1
  • 标签1
Top