diff --git a/lib/compat/wordpress-6.0/class-wp-webfonts-provider-local.php b/lib/compat/wordpress-6.0/class-wp-webfonts-provider-local.php index 6d1da877ae6d48..4a48332ba9d869 100644 --- a/lib/compat/wordpress-6.0/class-wp-webfonts-provider-local.php +++ b/lib/compat/wordpress-6.0/class-wp-webfonts-provider-local.php @@ -227,9 +227,9 @@ private function compile_src( $font_family, array $value ) { $src = "local($font_family)"; foreach ( $value as $item ) { - - if ( 0 === strpos( $item['url'], get_site_url() ) ) { - $item['url'] = wp_make_link_relative( $item['url'] ); + if ( 0 === strpos( $item['url'], 'file:./' ) ) { + $absolute_path_to_url = get_stylesheet_directory_uri() . '/' . str_replace( 'file:./', '', $item['url'] ); + $item['url'] = wp_make_link_relative( $absolute_path_to_url ); } $src .= ( 'data' === $item['format'] ) diff --git a/lib/compat/wordpress-6.0/register-webfonts-from-theme-json.php b/lib/compat/wordpress-6.0/register-webfonts-from-theme-json.php index 6547c62c2f8981..a11f34c4ea9207 100644 --- a/lib/compat/wordpress-6.0/register-webfonts-from-theme-json.php +++ b/lib/compat/wordpress-6.0/register-webfonts-from-theme-json.php @@ -41,19 +41,6 @@ function gutenberg_register_webfonts_from_theme_json() { $font_family['fontFace'] = (array) $font_family['fontFace']; foreach ( $font_family['fontFace'] as $font_face ) { - // Check if webfonts have a "src" param, and if they do account for the use of "file:./". - if ( ! empty( $font_face['src'] ) ) { - $font_face['src'] = (array) $font_face['src']; - - foreach ( $font_face['src'] as $src_key => $url ) { - // Tweak the URL to be relative to the theme root. - if ( 0 !== strpos( $url, 'file:./' ) ) { - continue; - } - $font_face['src'][ $src_key ] = get_theme_file_uri( str_replace( 'file:./', '', $url ) ); - } - } - // Convert keys to kebab-case. foreach ( $font_face as $property => $value ) { $kebab_case = _wp_to_kebab_case( $property );