wp_enqueue_style( 'google-font', 'https://fonts.googleapis.com/css?family=Kanit:100,200,300,400,400,500,700,900&display=swap' );
Basically, there was a mismatch between the file name in the local cache and the URL used as a replacement in the link.
I.e. The file was named kanit-v13-latin_latin-ext_thai_vietnamese-100.woff
but the URL was kanit-v12-vietnamese_latin-ext_latin-regular.woff2
, resulting in several 404 errors.
I was able to fix the issue with the following snippet thanks to the available filter:
// Fix to embed Kanit font via Embed Google Fonts plugin.
function bs_fix_embed_google_fonts_get_subsets( $subsets ) {
if ( ! in_array ( 'thai', $subsets ) ) {
$subsets[] = 'thai';
}
sort( $subsets );
return $subsets;
}
add_filter( 'embed_google_fonts_get_subsets', 'bs_fix_embed_google_fonts_get_subsets' );
However, it would be ideal to add 'thai' and reorder the subsets directly in the original plugin.
Thank you.