Site logo

Archived topic

Local font not rendering in editor

16 replies · Started by Whelan on September 19, 2020

Viewing posts 16–17 of 17

Can you share the code you were using to load local fonts in the editor?

WordPress 5.9 made it so the enqueue_block_editor_assets no longer loads assets in the tablet/mobile views in the editor, so it's necessary to use a different method now.

For example, add the @font-face CSS to a stylesheet and upload it to your child theme, then do this:

add_filter( 'generate_editor_styles', function( $editor_styles ) {
    $editor_styles[] = 'path/to/fonts/style.css';

    return $editor_styles;
} );

Sorry,
must have been late. Today all works fine. My standard admin enqueue method works fine.

function apuri_localfonts_in_editor(  ) {
	wp_enqueue_style( 'apuri-type', get_stylesheet_directory_uri() . '/assets/css/apuri-typography.css', false, APURI_VERSION, 'all');
}
add_filter( 'admin_enqueue_scripts', 'apuri_localfonts_in_editor');

I appologize.

This archived topic is closed to new replies.