• Resolved Artan

    (@artankrasniqi1988)


    Hi,

    as the laws in the European Union regarding data privacy get stricter, I need to remove the Google Fonts external integration:

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

    I have to store the font locally. I am using the child theme Mins. Can I somehow dequeue the script in the child-theme?:

    wp_enqueue_script( ‘primer-customizer-fonts’, get_template_directory_uri() . “/assets/js/admin/customizer-fonts{$suffix}.js”, array( ‘jquery’ ), PRIMER_VERSION, true );

    Help is appreciated.

    Thanks

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @artankrasniqi1988

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

    https://github.com/godaddy-wordpress/primer/blob/9136871be61d1a7d167b73814b98a30d7402df52/inc/customizer/fonts.php#L36-L68

    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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disable Google Fonts external integration’ is closed to new replies.