Site logo

Archived topic

Uploading Custom Fonts

5 replies · Started by Vladimir on November 11, 2022

Viewing posts 1–6 of 6

Hi,

I have custom fonts sent to me as .zip file. They were licensed from some 3rd party.

Where in the Interface do I upload such custom fonts and do I upload them as zip file, or I have to unzip them first and upload them then?

Vlad

I followed instructions and added extra snippet to allow font uploads to Media by adding this code to new snippet.

add_filter( 'upload_mimes', function( $mimes ) {
$mimes['woff'] = 'application/x-font-woff';
$mimes['woff2'] = 'application/x-font-woff2';
$mimes['ttf'] = 'application/x-font-ttf';
$mimes['svg'] = 'image/svg+xml';
$mimes['eot'] = 'application/vnd.ms-fontobject';

return $mimes;
} );

But when I try to upload .ttf file, it does not allow me to upload despite the the function. Here is the error message I get.

“Antenna Regular.ttf” has failed to upload.
Sorry, you are not allowed to upload this file type.

Are there any other ways to get that .ttf file into the website?

Hi there,

do you have .woff and .woff2 copies of the font ?
If so just use those - as they are supported by all modern browsers so the TTF isn't required.

Great advice on .woff font types. Thank you. Closing ticket.

Glad to be of help!

This archived topic is closed to new replies.