Block Editor PHP Beginner

Turn Off the Font Library

Stop editors installing and uploading fonts through the Site Editor's font library, keeping your typography consistent.

Tested on WordPress 7.1 PHP 8.3 No plugin needed Updated
functions.php 4 lines
add_filter( 'block_editor_settings_all', function ( array $settings ): array {
	$settings['fontLibraryEnabled'] = false;
	return $settings;
} );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.

Since WordPress 6.5, the Site Editor lets users install Google Fonts and upload font files. On a site with a defined brand, extra fonts break consistency and can slow pages down. This snippet turns the font library off.

How it works

Setting fontLibraryEnabled to false in block_editor_settings_all removes the “Manage fonts” option from the Site Editor’s typography settings. Fonts your theme already provides keep working.

Things to watch

  • Fonts already installed through the library stay installed. Remove them under Appearance → Editor → Styles → Typography before adding this snippet.
  • Nahnu Fonts manages fonts separately and isn’t affected.

How to test it

Open Appearance → Editor → Styles → Typography. The “Manage fonts” button should be gone.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only