When the Font Library was first introduced, developers could disable it via the block_editor_settings_all filter hook: #57818
There is also a Developer Blog tutorial published based on this hook: https://developer.wordpress.org/news/snippets/how-to-disable-the-font-library/
WordPress 7.0 introduced a new font-library.php (font-library-wp-admin in Gutenberg) screen under themes.php (Appearance) in the WordPress admin. The prior technique no longer works for disabling the font library. This means that any theme/plugin that previously disabled it, that extension's users are now seeing and accessing a screen that should not be there.
The current fix (on top of the previous code) for the new menu item:
add_action( 'admin_menu', function () {
remove_submenu_page( 'themes.php', 'font-library.php' );
} );
add_action( 'load-appearance_page_font-library', function () {
wp_die(
__( 'This feature has been disabled.' ),
__( 'Disabled' ),
[ 'response' => 403, 'back_link' => true ]
);
} );
And a little more if you need to disable it for both WordPress and the Gutenberg plugin because they use different admin menu slugs.
Technically, using the original hook still removes the font library from the editor, so this report is not a "bug" in that sense. However, it is a bug because it changes developer expectations.
I'd also like to propose an enhancement to the system altogether: use the theme supports system to let theme authors control this. Core could auto-opt into a font-library supports. Then, remove_theme_support('font-library') would be a simple one-liner that theme authors could employ without worrying about needing to update their code for any potential future changes.
When the Font Library was first introduced, developers could disable it via the
block_editor_settings_allfilter hook: #57818There is also a Developer Blog tutorial published based on this hook: https://developer.wordpress.org/news/snippets/how-to-disable-the-font-library/
WordPress 7.0 introduced a new
font-library.php(font-library-wp-adminin Gutenberg) screen underthemes.php(Appearance) in the WordPress admin. The prior technique no longer works for disabling the font library. This means that any theme/plugin that previously disabled it, that extension's users are now seeing and accessing a screen that should not be there.The current fix (on top of the previous code) for the new menu item:
And a little more if you need to disable it for both WordPress and the Gutenberg plugin because they use different admin menu slugs.
Technically, using the original hook still removes the font library from the editor, so this report is not a "bug" in that sense. However, it is a bug because it changes developer expectations.
I'd also like to propose an enhancement to the system altogether: use the theme supports system to let theme authors control this. Core could auto-opt into a
font-librarysupports. Then,remove_theme_support('font-library')would be a simple one-liner that theme authors could employ without worrying about needing to update their code for any potential future changes.