Disable Google Fonts external integration

[ad_1]

Hi @artankrasniqi1988

I believe if you use the primer_fonts filter to return an empty array, it will not enqueue any Google fonts.

Something like this should do the trick:


add_filter( 'primer_fonts', '__return_empty_array' );

Let us know if that helps.

Evan

Thread Starter
Artan

(@artankrasniqi1988)

Ok first step done. Primer fonts are gone but now child theme mins is throwing roboto to the site:

<link rel=’stylesheet’ id=’mins-fonts-css’ href=’https://fonts.googleapis.com/css?family=Roboto%3A300%2C400%2C700&subset=latin&ver=1.8.9&#8242; type=’text/css’ media=’all’ />

function mins_fonts( $fonts ) {

	$fonts[] = 'Roboto';

	return $fonts;

}
add_filter( 'primer_fonts', 'mins_fonts' );

/**
 * Set font types.
 *
 * @filter primer_font_types
 * @since  1.0.0
 *
 * @param  array $font_types
 *
 * @return array
 */
function mins_font_types( $font_types ) {

	$overrides = array(
		'site_title_font' => array(
			'default' => 'Roboto',
		),
		'navigation_font' => array(
			'default' => 'Roboto',
		),
		'heading_font' => array(
			'default' => 'Roboto',
		),
		'primary_font' => array(
			'default' => 'Roboto',
		),
		'secondary_font' => array(
			'default' => 'Roboto',
		),
	);

	return primer_array_replace_recursive( $font_types, $overrides );

}
add_filter( 'primer_font_types', 'mins_font_types' );

You know how to stop that too?

Would be great!

@artankrasniqi1988

Try changing the priority on the code I gave you so it runs after the mins_font_types.

add_filter( 'primer_fonts', '__return_empty_array', PHP_INT_MAX );

Otherwise you can try removing the filter from mins.

remove_filter( 'primer_font_types', 'mins_fonts' );

Thread Starter
Artan

(@artankrasniqi1988)

🙂

Thanks man! Seems to do the thing! So thankful!

Hope u have a wonderful evening! 😉

Great. Thank you – you too! Have a nice weekend!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer