Title: Adding custom Google fonts
Last modified: October 4, 2021

---

# Adding custom Google fonts

 *  [curiousjake](https://wordpress.org/support/users/curiousjake/)
 * (@curiousjake)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-google-fonts/)
 * Hi,
 * Just wanted to point out that I think one of the docs is out of date.. I have
   been struggling with adding a Google Font to the customizer list – the font ‘
   DM Mono’ (and perhaps others – I didn’t try) was failing to fetch variants even
   when I followed the instructions here: [https://docs.generatepress.com/article/customizing-the-google-font-list/#adding-your-google-font-to-the-list](https://docs.generatepress.com/article/customizing-the-google-font-list/#adding-your-google-font-to-the-list)
 * I changed the filter to from `'generate_typography_customize_list'` to `'generate_google_fonts_array'`
   and it seems to have sorted it.
 * Cheers,

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Elvin](https://wordpress.org/support/users/ejcabquina/)
 * (@ejcabquina)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-google-fonts/#post-14937640)
 * Hi Jake,
 * That filter is actually still in use.
    [https://github.com/tomusborne/generatepress/search?q=generate_typography_customize_list](https://github.com/tomusborne/generatepress/search?q=generate_typography_customize_list)
 * Perhaps the code you’ve used didn’t have a priority value?
 *  Thread Starter [curiousjake](https://wordpress.org/support/users/curiousjake/)
 * (@curiousjake)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-google-fonts/#post-14939126)
 * Hi [@ejcabquina](https://wordpress.org/support/users/ejcabquina/),
 * Thanks for the response! I don’t think I explained properly. Using the filter
   above _does_ add the font to the list, so I don’t think it’s a priority issue.
   The problem is that the filter isn’t applied when GP fetches font variants, so
   it isn’t possible to import the font variants from Google. The `'generate_google_fonts_array'`
   filter, however, is applied in the function `generate_get_all_google_fonts` function,
   which is called by `generate_get_google_font_variation`:
 *     ```
       /**
       	 * Wrapper function to find variants for chosen Google Fonts
       	 * Example: generate_get_google_font_variation( 'Open Sans' )
       	 *
       	 * @since 1.3.0
       	 *
       	 * @param string $font The font to look up.
       	 * @param string $key The option to look up.
       	 */
       	function generate_get_google_font_variants( $font, $key = '' ) {
       		// Don't need variants if we're using a system font.
       		if ( in_array( $font, generate_typography_default_fonts() ) ) {
       			return;
       		}
   
       		// Return if we have our variants saved.
       		if ( '' !== $key && get_theme_mod( $key . '_variants' ) ) {
       			return get_theme_mod( $key . '_variants' );
       		}
   
       		$defaults = generate_get_default_fonts();
   
       		if ( $defaults[ $key ] === $font ) {
       			return $defaults[ $key . '_variants' ];
       		}
   
       		// Grab all of our fonts.
       		// It's a big list, so hopefully we're not even still reading.
       		$fonts = generate_get_all_google_fonts();
   
       		// Get the ID from our font.
       		$id = strtolower( str_replace( ' ', '_', $font ) );
   
       		// If the ID doesn't exist within our fonts, we can bail.
       		if ( ! array_key_exists( $id, $fonts ) ) {
       			return;
       		}
   
       		// Grab all of the variants associated with our font.
       		$variants = $fonts[ $id ]['variants'];
   
       		// Loop through them and put them into an array, then turn them into a comma separated list.
       		$output = array();
       		if ( $variants ) {
       			foreach ( $variants as $variant ) {
       				$output[] = $variant;
       			}
   
       			return implode( ',', apply_filters( 'generate_typography_variants', $output ) );
       		}
       	}
       ```
   
 * Does that make sense or have I misunderstood?
 * Thanks!
    -  This reply was modified 4 years, 8 months ago by [curiousjake](https://wordpress.org/support/users/curiousjake/).
 *  [David](https://wordpress.org/support/users/diggeddy/)
 * (@diggeddy)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-google-fonts/#post-14939636)
 * Hi there,
 * can you share a link to the site with that font added and applied to the typography
   settings so we can see whats happening?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Adding custom Google fonts’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/generatepress/3.6.1/screenshot.
   png)
 * GeneratePress
 * [Support Threads](https://wordpress.org/support/theme/generatepress/)
 * [Active Topics](https://wordpress.org/support/theme/generatepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/generatepress/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/generatepress/reviews/)

## Tags

 * [google fonts](https://wordpress.org/support/topic-tag/google-fonts/)

 * 3 replies
 * 3 participants
 * Last reply from: [David](https://wordpress.org/support/users/diggeddy/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-google-fonts/#post-14939636)
 * Status: not a support question