Archived topic
Function mentioned in tutorial missing
1 reply · Started by hoya on January 18, 2023
I watched your video on adding local fonts. Firstly, the link on your documentation is no longer valid, although that page did give a redirect. However, that source is not showing the function that I need to copy in order to upload the font files to my media library. Can you paste the function here that I need to add to Code Snippets?
Hi Hoya,
Are you referring to this?:
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;
} );
If so, it can be found in this article: https://docs.generatepress.com/article/adding-local-fonts/#uploading-our-font