This function has been deprecated. Use astra_load_preload_local_fonts() instead.

ast_load_preload_local_fonts( string $google_font_url )

Deprecating ast_load_preload_local_fonts function.


Description

Preload Google Fonts – Feature of self-hosting font.

See also


Parameters

$google_font_url

(string) (Required) Google Font URL generated by customizer config.


Return

(string)


Source

File: inc/core/deprecated/deprecated-functions.php

function ast_load_preload_local_fonts( $url, $format = 'woff2' ) {

	// Check if cached font files data preset present or not. Basically avoiding 'Astra_WebFont_Loader' class rendering.
	$astra_local_font_files = get_site_option( 'astra_local_font_files', false );

	if ( is_array( $astra_local_font_files ) && ! empty( $astra_local_font_files ) ) {
		$font_format = apply_filters( 'astra_local_google_fonts_format', $format );
		foreach ( $astra_local_font_files as $key => $local_font ) {
			if ( $local_font ) {
				echo '<link rel="preload" href="' . esc_url( $local_font ) . '" as="font" type="font/' . esc_attr( $font_format ) . '" crossorigin>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
			}
		}
		return;
	}

	// Now preload font data after processing it, as we didn't get stored data.
	$font = astra_webfont_loader_instance( $url );
	$font->set_font_format( $format );
	$font->preload_local_fonts();
}

Changelog

Changelog
Version Description
3.7.4 Introduced.


User Contributed Notes

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