• Resolved missty19

    (@missty19)


    I’m trying to remove the access to the google fonts cdn server. The needed fonts files are locally saved. I tried it with this code at functions.php in my child theme.

    add_action( 'wp_print_styles', 'mh_dequeue_google_fonts_style', PHP_INT_MAX );
    function mh_dequeue_google_fonts_style() {
          wp_dequeue_style( 'chaplin-google-fonts' );
    }

    But this doesn’t work. If I deregister ‘chaplin-google-fonts’ the color changes won’t work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author Anders Norén

    (@anlino)

    Hi @missty19,

    The Google Fonts CSS is added as a dependency when it’s enqueued, so dequeueing it will result in other styles not loading. I’ve added filters for CSS and JS dependencies in Chaplin that were meant to be released with version 2.0 (hopefully coming in a couple of weeks), but I’ve fast tracked them to version 1.1.15, which should be live within an hour or two.

    When you’ve updated to that version, you’ll be able to remove the Google Fonts enqueue with this code:

    
    function mh_filter_css_dependencies( $css_dependencies ) {
    
    	$key = array_search( 'chaplin-google-fonts', $css_dependencies );
    	if ( $key !== false ) {
    		unset( $css_dependencies[$key] );
    	}
    
    	return $css_dependencies;
    
    }
    add_filter( 'chaplin_css_dependencies', 'mh_filter_css_dependencies' );
    

    Let me know if that does it.

    — Anders

    • This reply was modified 4 years, 11 months ago by Anders Norén.
    Thread Starter missty19

    (@missty19)

    Hi @anlino,
    first of all, thanks for the really quick reaction.

    The code works, but it takes quit a long time for the font to be displayed.

    missty19

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove access to Google Fonts cdn server’ is closed to new replies.