Site logo

Archived topic

How to completely disable google fonts?

14 replies · Started by Xiaowei on March 6, 2019

Viewing posts 1–15 of 15

Would setting all font to "System stack" in Typography do?

Thanks. What does "inherit" mean in typography settings?

Inherit means to use the font from the parent container.

So if the body font is set to Times New Roman. And the headings are set to Inherit they will also be Times New Roman.

If you set the Body font to Inherit then it will use the root font which is set by the users browser. Similar to using System Stack fonts.

which in the Typography settings is the global font? Previously I set "body" type to be "System Stack" and left all others as "inherit", observing network tab in chrome dev tools I still saw a request to google fonts.

You code works though. thanks. Now that request disappears.

Odd it should only call googles font if a font is requested.
At least the code eliminates that issue entirely. Let is know if you have any issues.

Sure,thanks.

You're welcome

David,

Well ... I may be still missing sth. my previous assessment wasn't correct. Still seeing the request. I have configured all fonts to "System Stack" and kept the code you previously gave me.

https://www.screencast.com/t/JJm0ybluEcX4

Thanks,
Shawn

My site's in China, google services isn't fluent there, so this is kinda important. I'm willing to do dirty hacks as long as I know how ... :)

When I hit theme customization, I got lots of PHP Warnings:

[Fri Mar 08 16:44:07.230791 2019] [proxy_fcgi:error] [pid 16816:tid 140549776467712] [client 47.74.63.77:42096] AH01071: Got error 'PHP message: PHP Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/54wzj/wp-content/plugins/gp-premium/typography/functions/migration.php on line 166\nPHP message: PHP Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/54wzj/wp-content/plugins/gp-premium/typography/functions/migration.php on line 166\nPHP message: PHP Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/54wzj/wp-content/plugins/gp-premium/typography/functions/migration.php on line 166\nPHP message: PHP Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/54wzj/wp-content/plugins/gp-premium/typography/functions/migration.php on line 166\nPHP message: PHP Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/54wzj/wp-content/plugins/gp-premium/typography/functions/migration.php on line 166\nPHP message: PHP Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/54wzj/wp-content/plugins/gp-premium/typography/functions/migration.php on line 166\nPHP message: PHP Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/54wzj/wp-content/plugins/gp-premium/typography/functions/migration.php on line 166\nPHP message: PHP Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/54wzj/wp-content/plugins/gp-premium/typography/functions/migration.php on line 166\nPHP message: PHP Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/54wzj/wp-content/plugins/gp-premium/typography/functions/migration.php on line 166\nPHP message: PHP Warning: array_key_exists() expects parameter 2 to be array, boolean given in /var/www/54wzj/wp-content/plugins/gp-premium/typography/functions/migration.php on line 185\n'

That's caused by this hook:

add_action( 'admin_init', 'wzj_remove_google_fonts_from_admin' );
function wzj_remove_google_fonts_from_admin() {
    add_filter( 'generate_google_fonts_array', '__return_false' );
}

and the request to google fonts turns out to be admin specific.

In the above article there are the two codes. The first removes the enqueue of the fonts, the second removes them from the Customizer list hence they are Admin specific.

Due to GDPR it would be very useful if GP provides a simple "disable all google fonts" button in Customizer or anywhere else. I have tried many workarounds and the above mentioned code snippets, but Google fonts are still being loaded on my clients site

It would be even better, if GP allows us to choose a google font, then download it so that these google fonts will be served locally.

Any chance to implement such feature?

Hi there,

GP only makes Google Font requests you have selected in the Customizer > Typography settings.
If there are no google fonts selected then GP will not make any requests for them.

On your client site i see 2x google fonts being requested in this link:

<link rel='stylesheet' id='wpgb-fonts-css' href='https://fonts.googleapis.com/css?family=Varela%20Round%3Aregular%7CRoboto%3A300' media='all' />

Which looks like its coming from the WP Grid Builder plugin.

Regarding Local fonts, we have plans to add this in GPP 2.2 - we have already done the ground work in GP 3.1 and GPP 2.2 ( currently in alpha/beta testing ).

This archived topic is closed to new replies.