[Resolved] How to completely disable google fonts?

Home Forums Support [Resolved] How to completely disable google fonts?

Home Forums Support How to completely disable google fonts?

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #831258
    Xiaowei

    Would setting all font to “System stack” in Typography do?

    #831372
    David
    Staff
    Customer Support

    Hi there,

    yes that would work. Customizer fonts are only loaded if they are selected.

    If you wanted to completely remove them so they don’t even show in the customizer then read here:

    https://docs.generatepress.com/article/remove-google-fonts/

    #831457
    Xiaowei

    Thanks. What does “inherit” mean in typography settings?

    #831463
    David
    Staff
    Customer Support

    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.

    #831466
    Xiaowei

    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.

    #831473
    David
    Staff
    Customer Support

    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.

    #831479
    Xiaowei

    Sure,thanks.

    #831485
    David
    Staff
    Customer Support

    You’re welcome

    #832514
    Xiaowei

    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.

    03.08.2019-15.56.48

    Thanks,
    Shawn

    #832517
    Xiaowei

    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 … 🙂

    #832531
    Xiaowei

    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'

    #832552
    Xiaowei

    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.

    #832666
    David
    Staff
    Customer Support

    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.

    #1941145
    Sascha

    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?

    #1941360
    David
    Staff
    Customer Support

    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 ).

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.