未在Wordpress中上传OTF字体
我想上传WordPress仪表板中的自定义字体。当我尝试上载字体文件时,它显示错误:未在Wordpress中上传OTF字体,wordpress,fonts,wordpress-theming,mime-types,Wordpress,Fonts,Wordpress Theming,Mime Types,我想上传WordPress仪表板中的自定义字体。当我尝试上载字体文件时,它显示错误: Sorry, this file type is not permitted for security reasons. 然后,我使用以下代码允许所有文件使用字体: add_filter('upload_mimes', 'add_custom_upload_mimes'); function add_custom_upload_mimes($existing_mimes) { $existin
Sorry, this file type is not permitted for security reasons.
然后,我使用以下代码允许所有文件使用字体:
add_filter('upload_mimes', 'add_custom_upload_mimes');
function add_custom_upload_mimes($existing_mimes) {
$existing_mimes['otf'] = 'application/x-font-opentype';
$existing_mimes['woff'] = 'application/x-font-woff';
$existing_mimes['ttf'] = 'application/x-font-ttf';
$existing_mimes['svg'] = 'image/svg+xml';
$existing_mimes['eot'] = 'application/vnd.ms-fontobject';
return $existing_mimes;
}
现在所有类型的字体都被上传了,但是当我上传.otf字体时,它显示了相同的错误
请帮我解决这个问题。提前感谢。尝试使用
$existing_mimes['otf'] = 'font/otf';
或
你很久没发这篇文章了。但我正在使用一个名为“WP Add Mime Types”的插件 作为插件设置(设置->Myme类型设置)中的一个值,我添加了以下内容:otf=application/x-font-opentype
它对我有效:)打击是解决此问题的步骤 打开WordPress安装的wp-config.php文件,在上面写着/*就这样,停止编辑!快乐博客。*/在任意位置添加以下代码:
define('ALLOW_UNFILTERED_UPLOADS', true);
参考:
define('ALLOW_UNFILTERED_UPLOADS', true);