Site logo

Archived topic

Custom font set up in typography, but it's not visible in the editor

8 replies · Started by scometamus on September 2, 2022

Viewing posts 1–9 of 9

As described in the title, I don't see the local font while editing, only on the published page. Any ideas here what I have set up wrong here maybe?

Best regards and thanks a lot in advance.

Hi! The fonts used are called IBM Plex Serif + IBM Plex Sans and they are used on the complete site, every pages. We used the method installing the fonts via the method you describe in the doc, except the uploading part, we did this ourselves via ftp.

Everything is displayed fine, except when being in the wordpress/gutenberg editor, then we see Times or some default Browser font.

So the issue is that the editor doesn't load @font-face CSS.

You can give this method a try:

1. Add this to your child theme's functions.php:

add_action( 'enqueue_block_editor_assets', function() {
    wp_enqueue_style( 'local_fonts_in_editor', get_stylesheet_directory_uri() . "/block-editor.css", false, '1.0', 'all' );
} );

2. Create a block-editor.css file in your child theme folder, add all the@font-face CSS along with other CSS that you want it to load in the editor.

Let me know if this works.

Interesting, will do later and report back.

Thanks a lot for the investigation.

Any ideas what causes the issue?

Update: it worked :) – would be nice to know that feature base-kit of GP though

You are welcome :)

The editor is actually controlled by WP, so WP editor doesn't load the @font-face CSS.

We use the PHP code to make it load the block-editor.css file :)

This archived topic is closed to new replies.