As a theme author, I often want tight control over typography options to offer users a curated set of fonts that work well for the theme. One of the first things I do is disable the Font Library in WordPress, ensuring that only the typesets I specifically chose are available to users. This completely disables the user’s ability to upload or manage custom fonts.
Whether it’s for a client site or a publicly distributed project, you might run into a similar scenario when designing a theme. To disable the Font Library, you can filter block_editor_settings_all
and set the fontLibraryEnabled
argument to false
by adding this code to your theme’s functions.php
file:
add_filter( 'block_editor_settings_all', 'devblog_block_editor_settings' );
function devblog_block_editor_settings( $settings ) {
$settings['fontLibraryEnabled'] = false;
return $settings;
}
Check out 15 ways to curate the WordPress editing experience for more techniques to customize the Editor.
Leave a Reply