Fontmanager / Custom Fonts / .woff .woff2

Hi there,
I try to get some custom fonts in the font manager. If I want to upload the files in the fontmanager, it accepts only .ttf, the .woff and .woff2 files can not be uploaded (not allowed due to security reasons).

In another thread I found a modification of the functions.php to get the .woff-files uploaded in the media manager.
But if I now go back to the font-manager’s import, only the .ttf-files are shown.

I would expect, that a font-manager could handly .woff and .woff2 by default, so what am I doing wrong?

Best regards

Uli

Hello Uli,

Thanks for reaching out. :slight_smile:

Please take a look at the solution provided in following threads and let us know how it goes. Please click on the title (link) to open the full thread:

Thanks.

Hi Prasant,

unfortunately, both threads don’t help. As I wrote, I already managed to upload the .woff / .woff2 files adding a custom
function, but the problem is, that they are not shown within the fontmanager (“Import Fonts”), only the .ttf-files are shown.

So there must be a bug in the font manager, that hides these files.

The code in my child-themes functions.php now looks - according to the above mentionned threads - like that:

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

    function font_mime_types($mimes) {
      $mimes['svg'] = 'image/svg+xml';
      $mimes['woff'] = 'font/woff';
      $mimes['woff2'] = 'font/woff2';
      return $mimes;
    }
    add_filter('upload_mimes', 'font_mime_types');

Best regards

Uli

Hi Uli,

The font manager only uses the upload manager provided by Wordpress, all configuration is handled by Wordpress itself. the font manager only opens a popup where Wordpress handles the uploads and forwarded the resulting URL back to the font manager. And security is handled by host environment that’s why it has varying result from user to user.

Would you mind providing your admin login credentials and FTP credentials in a secure note for further checking? I can’t promise any solution but maybe I could provide some guidance based on the information I could get. For the meantime,
you can install this plugin https://wordpress.org/plugins/add-from-server/ and upload your fonts using through that, then head back to Font Manager and import the font (by opening the media library pop up), but instead of uploading, just select the already uploaded fonts through that plugin.

Thanks!

Hi Rad,

I think there is a misunderstanding. As I wrote in the previous two posts, I did already upload all fonts.

The problem is, that these uploaded fonts are not shown in the media library popup in the font-manager.

I’ll send you access via secure note.

Uli

Hi Uli,

It looks like it’s a combination of server and WordPress setup that permits a file format to be uploaded. In one of my test sites for instance, even TTF was not accepted.

I was able to use WOFF and WOFF2 in my test site via the method below.

  1. Upload the font files in your web server preferably the uploads folder.
  2. Install the Add From Server
  3. Add the font files to your Media Gallery
  4. Once available in the Media Gallery, you will be able to choose the woff and woff2 font formats.

Hope that helps.

Great, that works.

Would be great, if adding fonts would work out of the box without any extra plugins, manual upload and all this stuff - probably with the next update?

Best regards

Uli

2 Likes

Hey Uli,

I have noted your feedback and forwarded this to our developers so that they can take action.

Best Regards.

1 Like

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