WP_Font_Face_Resolver::maybe_parse_name_from_comma_separated_list( string $font_family ): string

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Parse font-family name from comma-separated lists.

Description

If the given fontFamily is a comma-separated lists (example: "Inter, sans-serif" ), parse and return the fist font from the list.

Parameters

$font_familystringrequired
Font family `fontFamily’ to parse.

Return

string Font-family name.

Source

private static function maybe_parse_name_from_comma_separated_list( $font_family ) {
	if ( str_contains( $font_family, ',' ) ) {
		$font_family = explode( ',', $font_family )[0];
	}

	return trim( $font_family, "\"'" );
}

Changelog

VersionDescription
6.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.