WP_Font_Face_Resolver::get_fonts_from_theme_jsonpublic staticWP 6.4.0

Gets fonts defined in theme.json.

Method of the class: WP_Font_Face_Resolver{}

No Hooks.

Returns

Array. Returns the font-families, each with their font-face variations.

Usage

$result = WP_Font_Face_Resolver::get_fonts_from_theme_json();

Changelog

Since 6.4.0 Introduced.

WP_Font_Face_Resolver::get_fonts_from_theme_json() code WP 7.0

public static function get_fonts_from_theme_json() {
	$settings = wp_get_global_settings();

	// Bail out early if there are no font settings.
	if ( empty( $settings['typography']['fontFamilies'] ) ) {
		return array();
	}

	return static::parse_settings( $settings );
}