• Resolved Daan van den Bergh

    (@daanvandenbergh)


    Hi!

    I’m trying to remove the loading of Google Fonts from the theme, because I want to save the webfonts locally to save DNS requests.

    While digging through the code of the theme I found the following lines:

    wp_enqueue_style( 'onepress-fonts', onepress_fonts_url(), array(), null );

    So I wrote a function in my child theme’s functions.php to dequeue the style:

    function dequeue_google_fonts() {
    	wp_dequeue_style( 'onepress-fonts' );
    }
    add_action( 'wp_enqueue_style', 'dequeue_google_fonts', 20);

    But it isn’t working? Could you tell me what I’m doing wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author FameThemes

    (@famethemes)

    Did you try : add_action( 'wp_enqueue_scripts', 'dequeue_google_fonts', 20);

    Or you can use translate file to turn off Google Fonts, read this code from default theme :

    /*
    	 * Translators: If there are characters in your language that are not supported
    	 * by Noto Serif, translate this to 'off'. Do not translate into your own language.
    	 */
    	if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) {
    		$fonts[] = 'Noto Serif:400italic,700italic,400,700';
    	}
    Thread Starter Daan van den Bergh

    (@daanvandenbergh)

    I ended up finding that translator-thing, too. And it worked, but thank you for the solution of the action. I’ll try it later, just to see if it would work. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Dequeue Google Fonts’ is closed to new replies.