Skip to content

Snippet: Add Extra Google Font Options

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

The following snippet can be used to add extra Google Font options or override the entire list of available Google font options available in the Customizer > Typography panel or exclusive Total theme elements.

/**
 * Register new Google font option.
 *
 * @link https://total.wpexplorer.com/docs/snippets/add-new-google-fonts/
 */
add_filter( 'wpex_google_fonts_array', function( $array ) {
    $array[] = 'Rubik';
    return $array;
} );

/**
 * Override the entire Google Fonts List.
 *
 * @link https://total.wpexplorer.com/docs/snippets/add-new-google-fonts/
 */
add_filter( 'wpex_google_fonts_array', function( $array ) {
    return [ 'Open Sans', 'Roboto', 'Lobster' ];
} );
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