Skip to content

Snippet: Custom Google Font Lists

Important: You can now register your own fonts right via the WP admin via the exclusive Total theme Font Manager.

Using a filter you can define which Google Fonts are available when selecting fonts in the Customizer or in theme elements/shortcodes. So instead of loading hundreds of options you can load only the ones you will be using on the site.

/**
 * Changes the Google Font options in the theme.
 *
 * @link https://total.wpexplorer.com/docs/snippets/custom-google-font-lists/
 */
add_filter( 'wpex_google_fonts_array', function( $array ) {
    return [ 'Open Sans', 'Roboto', 'Source Sans Pro' ];
} );
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