我试图用
wp_handle_upload()
为了允许字体文件的类型,我在functions.php中添加了下面的代码
function allow_font_mime_types($mimes) {
$mimes['eot'] = 'application/vnd.ms-fontobject';
$mimes['woff'] = 'application/font-woff';
$mimes['otf'] = 'application/vnd.oasis.opendocument.formula-template';
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'allow_font_mime_types');
出于安全原因,不允许使用此文件类型