Alert: 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.

WP_Font_Face_Resolver::to_theme_file_uri( array $src ): array

Converts each ‘file:./’ placeholder into a URI to the font file in the theme.


The ‘file:./’ is specified in the theme’s theme.json as a placeholder to be replaced with the URI to the font file’s location in the theme. When a "src" beings with this placeholder, it is replaced, converting the src into a URI.

Top ↑


$src array Required
An array of font file sources to process.

Top ↑


array An array of font file src URI(s).

Top ↑


File: wp-includes/fonts/class-wp-font-face-resolver.php. View all references

private static function to_theme_file_uri( array $src ) {
	$placeholder = 'file:./';

	foreach ( $src as $src_key => $src_url ) {
		// Skip if the src doesn't start with the placeholder, as there's nothing to replace.
		if ( ! str_starts_with( $src_url, $placeholder ) ) {

		$src_file        = str_replace( $placeholder, '', $src_url );
		$src[ $src_key ] = get_theme_file_uri( $src_file );

	return $src;

Top ↑


Version Description
6.4.0 Introduced.

Top ↑

User Contributed Notes

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