Remove or deque certain google fonts

Hi there.

My site loads a lot of fonts, 9 in total, some are for the recaptcha, but the others are for the site, I only use the weights 300 and 400, is there a way of disabling or dequeing the other fonts? so 100,500,700, and 900?

Thanks.

Hello There,

Thanks for writing in! Please go to X > Fonts and make sure that the 100,500,700, and 900 is not selected in one of your fonts. To know more about the Font manager, please check this out: https://theme.co/apex/forum/t/font-manager/101

Hope this helps.

Like I said, I only use 300 and 400.

Hello There,

Would you mind providing us access to the site so that we can investigate where the other fonts is coming from?

Thanks.

Sure, I know for a fact one of them is form the contact form (recaptcha) is there no way of dequing them?

See secure note for login

Hello There,

Could you please disable the login plugin because we cannot login as of this moment.

Thank you in advance.

Hmmm, is there not a way I can deque the fonts?

Hey There,

You cannot dequeue a font if you are using it. Usually it is loaded like this:

<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,700,900" rel="stylesheet">

The only you can remove the others is to make it like this:

<link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet">

Unless another instance is loaded which may have been coming from another plugin, then you maybe able to dequeue the font using a custom code or an option in the plugin. We need to take a closer look behind your dashboard to carefully check where it is coming from.

Hope this helps.

Can you try and log in again, I disabled the plugin, I have also started to host the font locally (to work better with my cdn) but there are more instances running, one is deffo re-capchta, but im not sure on the others, can you help?

I did some testing, and its cornerstone, how do I stop it form loading extra fonts?

Hi @logoglo,

Please try adding this code to your child theme’s functions.php

function cs_no_google_fonts() {
   wp_dequeue_style( 'cs-open-sans' );
   wp_dequeue_style( 'cs-lato' );
}
add_action( 'wp_print_styles', 'cs_no_google_fonts', 99999 );

There is no guarantee that it may work since plugin codes have different loading priorities than the theme.

Thanks!

Hi, yeah, didnt work, would you mind having a look to see where all those fonts are coming from? its taking its toll on the load speed, im pretty sure its cornerstone, when I disable the plugin, those extra fonts disappear.

Hi @logoglo,

That code is located at cornerstone\includes\classes\app\class-app.php

At line 71, like this

  public function register_font_styles() {

    $subsets = 'latin,latin-ext';

    //
    // translators: To add an additional subset specific to your language,
    // translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language.
    //

    $subset = _x( 'cs-no-subset', 'Translate to: (greek, cyrillic, vietnamese) to add an additional font subset.' );

    if ( 'cyrillic' === $subset ) {
      $subsets .= ',cyrillic,cyrillic-ext';
    } elseif ( 'greek' === $subset ) {
      $subsets .= ',greek,greek-ext';
    } elseif ( 'vietnamese' === $subset ) {
      $subsets .= ',vietnamese';
    }

    wp_register_style( 'cs-open-sans', "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets" );
    wp_register_style( 'cs-lato', "https://fonts.googleapis.com/css?family=Lato:400,700&subset=$subsets" );
  }

Thanks.

I dont know what you mean? that is showing open-sans and lato, the extra fonts on my page are duplicates of roboto…if I disable cornerstone, they disappear and there is only one font loading.

Hi @logoglo,

I couldn’t find any duplicate declaration of Roboto font on your site since it’s fully optimized. Would you mind disabling them first especially the minification? I’ll let you do that as I don’t want to change anything from your live site.

Thanks!

This is happening with minification etc:

The ones that start KFO… (these disappear when I disable cornerstone)

Hi @logoglo

I believe we need to see it “without” all the performance techniques you are using, I mean without minification, specially the rocket loader service from Cloudflare, otherwise please provide us with WordPress Dashboard login details in Secure Note to check this issue.

Thanks.

I have tested it without as well, they only disappear when I disable cornerstone. I have a plugin installed now called perfmatters, and I can disable scripts form certain pages, I disabled x-fonts, and its gotten rid of them, I believe the still load because the zopim chat plugin uses them.

Hi,

Glad to know you were able to figure it out.

Have a nice day! :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.