Skip to content

Snippet: Adding New Google Font Options To The TinyMCE Editor

Deprecated in Total 5.0 This functionality was deprecated in Total 5.0 because it caused more harm then good such as customers manually altering fonts in the Editor instead of globally in the Customizer then having to re-change them manually as well as this functionality requires loading extra scripts in the WP admin slowing things down. It's best to set your site fonts in the Customizer, WPBakery builder modules or Gutenberg. This is an optimization.

/**
 * Example function for adding new Google Fonts to the TinyMCE
 *
 * @deprecated 5.0
 */
function myprefix_wpex_mce_fonts( $fonts ) {
	$fonts[] = 'Roboto Sans'; // Add Roboto Sans
	return $fonts;
}
add_filter( 'wpex_mce_fonts', 'myprefix_wpex_mce_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