Site logo

Archived topic

Unwanted contact fonts.googleapis

12 replies · Started by John David on February 13, 2023

Viewing posts 1–13 of 13

Hi there,

I am using Generatepress premium and Generateblocks.
I have installed a locally hosted font and customised my site to use it.
However, my site still contacts googleapis - whether it actually downloads fonts there or not I don't know. But I want to remove that contact.
I see the following on my home page:
<link rel='dns-prefetch' href='//fonts.googleapis.com' />
and
<link rel='stylesheet' id='generateblocks-google-fonts-css' href='https://fonts.googleapis.com/css' media='all' />
I assume one is created by Gpress and the other by Gblocks.

I have read and tried everything I can find, and nothing seems to help.
For example, I have placed this in a code snipet:
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'generate-fonts' );
} );
add_action( 'admin_init', function() {
add_filter( 'generate_google_fonts_array', '__return_empty_array' );
} );
To no effect.

I read in Generateblocks that there is a simple switch (https://docs.generateblocks.com/article/typography-overview/), but it does not show on my site.
None of the advice I can find seems to apply.

Please can you tell me what to do?

Hi there,

can you share a link to your site where i can look to see which GenerateBlocks element has a google font applied to it.

:)
Is there a specific page or post where the request is being made ?

I checked these instances of contacting googleapis on my home page, but it's the same on all pages.

I checked the waterfall, funny, it has this close to the top:
css (canceled) fonts.googleapis.com 0 78ms
open-sans-v18-latin-regular.woff2 (canceled) halifax-translation.com 0 333ms
open-sans-v18-latin-600.woff2 (canceled) halifax-translation.com 0 362ms
open-sans-v18-latin-italic.woff2 (canceled) halifax-translation.com 0 401ms
open-sans-v18-latin-600italic.woff2 (canceled) halifax-translation.com 0 441ms

Then, almost as the last item, it proceeds to load the fonts from our site.

Can there be an issue with using 'font-display: swap;' in the @font-face declarations?

Ah ok, it didn't show before, maybe a cache thing.

Looking at the GB CSS.
I see 4 instances of where a font has been selected in the block editor.
And they are all buttons, the Get a Quote, Mail Us, Call Us and other Get a Quote.

Can you check to see if any of those have the Google font selected ?

D'oh! (as Homer Simpson says).

That's where the Gblocks Googleapis option is!

This seems to be the solution. Many thanks!

An interesting point for anyone with the same problem:
Where I have a stack of a few cells, when I work down switching off the "Use Googleapis font" toggle, the third one in each stack re-sets itself to "on" as I go further down. I have to check them again. When I switch it off for a second time, it stays off.

Thanks again for your patience!

Oh, and one more thing:
Where I have a single button, there is no Googleapis font toggle to be seen (this is why I dd not understand the advice I previously found on this forum). It's only where I have a stack that the toggle is visible in each cell.

Glad to hear you got it resolved.
We will be improving the way GB handles google fonts in the future, including a filter to disable the API completely.

:)

Great.
Thanks once more for excellent support.

This archived topic is closed to new replies.