Remove/dequeue fonts.googleapis.com from header and instead loading fonts directly from the site

This topic has 8 replies, 2 voices, and was last updated 1 years, 7 months ago ago by Rose Tyler

  • Avatar: Farcela
    Farcela
    Participant
    September 5, 2022 at 10:14

    Hi,

    I need this becasue of the following reasons:
    1- Page speed
    2- Most importantly the GDPR (General Data Protection Regulation)

    I’ve tried to add the following code in child-theme functions.php that I’ve found in another topic from years ago on your website but it didn’t work:

    function custom_remove_styles() {
    global $wp_styles;
    wp_dequeue_style('font-roboto');
    wp_dequeue_style('font-open-sans');
    }
    add_action( 'wp_enqueue_scripts', 'custom_remove_styles' ,131);

    My question is:
    1) How can I remove/dequeue fonts.googleapis.com with functions.php?
    2) Do I need to make changes in css (or other places) when using custom fonts?

    Thanks in advance.

    7 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 5, 2022 at 14:30

    Hello,

    XStore Control Panel -> Custom fonts, after you upload fonts you may select them in the list of Typography fonts (Theme Options -> Typography) -> http://prntscr.com/vobjsf , and so on. So that the uploaded font will be loaded locally.

    Regards

    Avatar: Farcela
    Farcela
    Participant
    September 5, 2022 at 16:12

    Hi,

    I’ve already tried that but that doesn’t remove or dequeue the fonts.googleapis.com from the header https://prnt.sc/KAqnrePIJsPQ
    https://prnt.sc/ygftLlFgetmS

    I want to remove it completely.
    Regards

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 6, 2022 at 10:09

    Hello,

    Provide URL of your site, temporary wp-admin, and FTP access.

    Regards

    Avatar: Farcela
    Farcela
    Participant
    September 6, 2022 at 17:27

    Hi,

    See Private content area.

    Regards.

    Please contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 7, 2022 at 10:53

    Hello,

    Our answer contains screenshots from your site, so we posted it via the Private Content area, please check.

    Regards

    Please contact administrator
    for this information.
    Avatar: Farcela
    Farcela
    Participant
    September 8, 2022 at 13:26

    Hi ,

    Thanks for your answers!

    By adding the following code to child functions.php it disabled google fonts.
    add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );
    Source: https://elementor.com/help/speed-up-a-slow-site/

    Regards

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 9, 2022 at 07:31

    Hello,

    Thanks for letting us know.
    Have a nice day!

    Regards

  • Viewing 8 results - 1 through 8 (of 8 total)

The issue related to '‘Remove/dequeue fonts.googleapis.com from header and instead loading fonts directly from the site’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.