OTF font not extended in Wordpress
I want to upload custom fonts to my WordPress dashboard. When I try to load the font file, it shows an error:
Sorry, this file type is not permitted for security reasons.
Then I resolved the font to all files using the following code:
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;
}
Now all font types are loaded, but when I load the .otf font it shows me the same error.
Please help me to solve this problem. Thanks in advance.
+3
source to share
3 answers