• Resolved Jens

    (@indexlift)


    Hi there,

    I would like to use a function to prevent google fonts from being loaded via fonts.googleapis.com. Unfortunately I can’t get the following two requests deleted from the source code:

    <link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Google+Sans:400,500,700|Google+Sans+Text:400&lang=de">
    
    <link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Google+Sans+Text:400&text=%E2%86%90%E2%86%92%E2%86%91%E2%86%93&lang=de">

    I also don’t know how to use these fonts locally on the server. (I have already successfully converted other fonts locally.) Appreciate any advice on this, thanks.

    • This topic was modified 2 years, 5 months ago by Jens.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The issue of Google Fonts removal is a really big one, especially in the EU. There are no standardized instructions for this because every WordPress project is different. Many plugins that “bring” Google Fonts offer options for this. Many others do not. Unfortunately, it is the same with themes.

    In your case it is impossible to tell where these 2 lines come from. My recommendation would be that you test deactivate plugins and see by whose deactivation the output is gone. Also a rattling off all settings in wp-admin can be useful (even if annoying).

    More precise can not tell you without a link to your page and the knowledge of his project.

    Thread Starter Jens

    (@indexlift)

    threadi, thanks for the tip. I have determined the plugin: “Rhythm Addons” as a optional part of the rhythm theme. When i deactivate this plugin, the two lines are no longer included in the html code. I opened all files of the plugin and searched for “fonts.googleapis.com”. In only one file I found what I was looking for – where it says “http” instead of “https”. However, modifying the url to test it did not bring any change. Maybe someone has a tip?

    $id        = ( $id ) ? ' id="'. esc_attr($id) .'"' : '';
      $class     = ( $class ) ? ' '. sanitize_html_classes($class) : '';
      $customize = ($font || $font_color || $letter_spacing || $transform || $font_style || $font_weight || $font_size || $margin_top || $margin_bottom ) ? true:false;
      $output = '';
      if(strpos($font, 'google') !== false) {
        $font_weight_type = ($font_style == 'italic' && $font_weight ) ? $font_weight.$font_style:$font_weight;
        $ifont_name  = str_replace('google_web_font_', '', $font);
        $font_name  = str_replace(' ', '+', $ifont_name);
        $output .=  "<link href='https://fonts.googleapis.com/css?family=".esc_attr($font_name).":".esc_attr($font_weight_type).", 400, 300, 600' rel='stylesheet' type='text/css'>";
      } else {
    	$ifont_name = $font;
      }

    Rhythm Addons seems to be a commercial plugin which comes with a theme you bought. I would recommend you to contact their support or to use another theme and thus do without this plugin.

    You can’t see anything in the shown code that speaks for the possibility of deactivating the integration.

    Thread Starter Jens

    (@indexlift)

    Okay, thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove Google fonts with functions?’ is closed to new replies.