Uploading custom font to Theme

Hi there,

I’m building a site to which I would like to add a custom font:

Here’s what I’m doing, and the font just disappears. Am I doing something wrong or using the wrong file?

Initially, WP does not accept woff, woff2 uploads, so here’s what I added to cross that bridge:

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

Hello @Pbalazs89,

Thanks for writing in!

To upload your custom fonts, please check out our Youtube tutorial:

Please do not forget to check out videos:

Subscribe to our channel for more updates, tips and how to videos.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.