diff --git a/projects/packages/google-fonts-provider/changelog/fix-global-styles-fonts b/projects/packages/google-fonts-provider/changelog/fix-global-styles-fonts new file mode 100644 index 000000000000..03e083a78f97 --- /dev/null +++ b/projects/packages/google-fonts-provider/changelog/fix-global-styles-fonts @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Use wp_get_global_styles() and fallback to gutenberg_get_global_styles() since the latter was removed from Gutenberg diff --git a/projects/packages/google-fonts-provider/package.json b/projects/packages/google-fonts-provider/package.json index 29c760336f68..0dd1509e8b29 100644 --- a/projects/packages/google-fonts-provider/package.json +++ b/projects/packages/google-fonts-provider/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-google-fonts-provider", - "version": "0.4.0", + "version": "0.4.1-alpha", "description": "WordPress Webfonts provider for Google Fonts", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/google-fonts-provider/#readme", "bugs": { diff --git a/projects/packages/google-fonts-provider/src/introspectors/class-global-styles.php b/projects/packages/google-fonts-provider/src/introspectors/class-global-styles.php index 292c42eecade..75c4b5d7dc97 100644 --- a/projects/packages/google-fonts-provider/src/introspectors/class-global-styles.php +++ b/projects/packages/google-fonts-provider/src/introspectors/class-global-styles.php @@ -40,11 +40,12 @@ public static function enqueue_global_styles_fonts() { * @return array Font faces from Global Styles settings. */ public static function collect_fonts_from_global_styles() { - if ( ! function_exists( 'gutenberg_get_global_styles' ) ) { + if ( ! function_exists( 'gutenberg_get_global_styles' ) && ! function_exists( 'wp_get_global_styles' ) ) { return array(); } - $global_styles = gutenberg_get_global_styles(); + $global_styles = function_exists( 'wp_get_global_styles' ) ? + wp_get_global_styles() : gutenberg_get_global_styles(); $found_webfonts = array();