Skip to content

Snippet: Remove Google Font Options from the Customizer

Important: You can now register your own fonts right via the WP admin via the exclusive Total theme Font Manager. If you have any custom fonts registered in the Font Manager it will automatically remove all Google options from the Customizer and builder elements so only your custom defined fonts will display.

The following snippet can be used to remove all the Google Font options from the Customizer to slim things down. This is useful if you are using native fonts only like the System UI font to slim down the Customizer and make it load a little bit quicker.

/**
 * Remove all Google Font Options.
 *
 * @link https://total.wpexplorer.com/docs/snippets/remove-customizer-google-font-options/
 */
function myprefix_remove_customizer_google_fonts( $array ) {
	if ( is_customize_preview() ) {
		$array = [];
	}
	return $array;
}
add_filter( 'wpex_google_fonts_array', 'myprefix_remove_customizer_google_fonts' );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top