Tell the browser to download your main self-hosted font file early, so text appears in the right font sooner.
add_action( 'wp_head', function (): void {
// Path to your font inside the active theme. Use the woff2 file your CSS actually loads.
$font = get_theme_file_uri( 'assets/fonts/inter-variable.woff2' );
printf(
'<link rel="preload" href="%s" as="font" type="font/woff2" crossorigin>' . "\n",
esc_url( $font )
);
}, 1 );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
Browsers only discover a font after downloading and reading the CSS that uses it, so text can appear in a fallback font first and then jump. Preloading your main font starts the download immediately.
The snippet prints a <link rel="preload" as="font"> tag at the very top of the head. get_theme_file_uri() builds the URL inside your active theme, or the parent theme if a child theme doesn’t have the file.
Fonts are always fetched in CORS mode, so the crossorigin attribute is required, even for fonts on your own domain. Without it the browser downloads the font twice.
Open DevTools → Network, filter by Font and reload. Your font should be one of the first requests, with no duplicate download.