Browse Source

fix a warning in the case where the fonts aren't defined

Ben Dwyer 4 years ago
parent
commit
273a5db258
1 changed files with 3 additions and 2 deletions
  1. 3 2
      blank-canvas-blocks/functions.php

+ 3 - 2
blank-canvas-blocks/functions.php

@@ -50,9 +50,10 @@ function blank_canvas_blocks_fonts_url() {
 	$fonts_url = '';
 
 	$theme_data = WP_Theme_JSON_Resolver::get_merged_data()->get_settings();
-	$font_families = $theme_data['defaults']['custom']['fontsToLoadFromGoogle'];
+	$custom_data = $theme_data['defaults']['custom'];
+	if ( array_key_exists( 'fontsToLoadFromGoogle', $custom_data ) ) {
+		$font_families = $theme_data['defaults']['custom']['fontsToLoadFromGoogle'];
 
-	if ( $font_families ) {
 		$font_families[] = 'display=swap';
 
 		// Make a single request for the theme fonts.