How to stop loading google font in Hustle

I don’t want to use the font comes with Hustle. I have changed the font using css, but in the background, it’s still loading the google font and that is decreasing my performance score.

  • Predrag Dubajic
    • Support

    Hi Mark,

    Hope you’re doing well.

    I’m afraid that there’s currently no way of excluding the fonts without editing plugin files directly.

    I will report this to our developers so they can check it out and change the way that fonts are loaded so they can be excluded via PHP directly.

    Best regards,

    Predrag

  • Predrag Dubajic
    • Support

    Hi Mark,

    I’m afraid that there’s still no solution to this without modifying the plugin code, as there are no filters to be applied, the report is still open and this should be changed in future releases.

    At the moment you would need to edit /hustle/inc/hustle-module-front.php file and comment out or remove lines 127 and 128:

    wp_register_style( 'hstl-roboto', 'https://fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i|Roboto:300,300i,400,400i,500,500i,700,700i', $this->_hustle->get_const_var(  "VERSION" ) );
    wp_register_style( 'hstl-opensans', 'https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i', $this->_hustle->get_const_var( "VERSION" ) );

    Best regards,

    Predrag

  • Adam
    • Support Gorilla

    Hello Mark,

    While checking your site with browser’s developer tools I noticed that you got Autoptimize plugin enabled which is doing some caching and optimization (minification and compression of JS/CSS resources). That is very often affecting reports’ results after changes made to the site.

    Therefore, I cleared Autoptimize cache (didn’t make any changes in configuration whatsoever, only purged cache so any possible “leftovers” from before change in plugin were removed) and run GTMetrix on site again and here is the result:

    https://gtmetrix.com/reports/smartminds.io/5xMtsAB1

    It’s very close to the one that you shared that shows score with Hustle inactive and it doesn’t actually include the fonts issue there. That said, I think Predrag’s solution worked here and it was only Autoptimize cache that was causing a “false” performance score.

    Kind regards,

    Adam

  • Mark
    • Design Lord, Child of Thor

    Hi Adam,

    There is slight performance increase I accept that but this fonts are not removed completely if you see below screenshot, the fonts Roboto and Opensans are being called still and this fonts are from Hustle. I just don't want to increase my site load speed for the things I am not being used.

  • Predrag Dubajic
    • Support

    Hi Mark,

    Hmm, it looks like the fonts are not showing in page source but they are indeed showing in GTMetrix results.

    Can you try downloading the above zip file, unpack it and place both .css files inside /hustle/assets/css/ folder.

    Clear your caching and then run the test again.

    Let us know how it goes.

    Best regards,

    Predrag

  • Mark
    • Design Lord, Child of Thor

    Also can you notify your developers about this issue and also to implement this feature in coming updates, because if they didn’t implement this feature and if I update the plugin all the work done now is gone.

  • Predrag Dubajic
    • Support

    Hi Mark,

    To be honest I’m not completely sure what exactly happens here, how the fonts are loaded, and why the results are different in page source and GTMetrix test.

    With each my finding, during work on this ticket, I’ve updated my original report so it’s all there already :slight_smile:

    Best regards,

    Predrag

  • Mark
    • Design Lord, Child of Thor

    Hi Predrag,

    I can see a update for hustle and also came to know the above changes were not implemented which means if I update the plugin all the core changes which were done as suggested by you above will be gone and my issue re occurs any word on this?

  • Predrag Dubajic
    • Support

    Hi Mark,

    I understand your frustration, but unfortunately fixes took priority over this in the latest release and this change didn’t made the cut just yet.

    Julian interesting suggestion, I think that the initial solution will be to allow to simply dequeue the fonts, but I will forward this to developers to consider adding a toggle switch for this.

    Best regards,

    Predrag

  • Mark
    • Design Lord, Child of Thor

    Hello Predrag,

    I see there is an update available for Hustle again but in changelog I cannot see the change I requested for, can you please check and confirm whether the change was implemented so that I can update the plugin else I need to again make the changes as I am doing since last 3 months or so

  • Predrag Dubajic
    • Support

    Hi Mark,

    I’m afraid that this hasn’t been included yet, I do understand your frustration but there are also bug fixes that are being taken care of in these updates and those take priority over feature requests as this one.

    We do still have it on the to-do list and hopefully it will make it into the next release.

    Best regards,

    Predrag

  • Mark
    • Design Lord, Child of Thor

    Ok I am habituated of hearing the same old thing and lost the trust already.

    And to inform the previous method of solving the issue also cannot be done after updating to latest version there is nothing in inc folder and the css files to be replaced are different too. Can you jump into this and provide quick solution like which worked before

  • Adam
    • Support Gorilla

    Hello mark

    Please disregard my post above, I have accidentally hit “Post” button before actually writing a message.

    As for the issue. I’m really sorry for keeping you waiting. Our developers are working hard on improving Hustle and other plugins and fixing any bugs is a priority. I understand very well that this particular issue is important but it’s rather an “optimization” than a bug. Like my colleague Predrag said, it is “on the table” and will be addressed.

    I have messaged our developers again, letting them know that the previous workaround needs an update and asking them to take care of it in general (in plugins core) as soon as possible.

    Kind regards,

    Adam

  • Predrag Dubajic
    • Support

    Hi Mark,

    Looks like there were some small changes in Hustle file structure and these changes should remove the fonts now:

    #1 In /hustle/inc/hustle-module-front.php comment out lines 132, 133, 138 and 139:

    wp_register_style( 'hstl-roboto', 'https://fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i|Roboto:300,300i,400,400i,500,500i,700,700i', $this->_hustle->get_const_var(  "VERSION" ) );
    wp_register_style( 'hstl-opensans', 'https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i', $this->_hustle->get_const_var( "VERSION" ) );

    wp_enqueue_style('hstl-roboto');
    wp_enqueue_style('hstl-opensans');

    It should look like this:

    [attachments are only viewable by logged-in members]

    #2 In /hustle/assets/css/ edit front.min.css and grid.min.css and from both remove this code at the begging of the file code:

    @import url("https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i");@import url("https://fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i|Roboto:300,300i,400,400i,500,500i,700,700i");@import url("https://fonts.googleapis.com/css?family=Source+Code+Pro");

    Save the changes and that should do the trick now.

    Best regards,

    Predrag

  • SWS
    • Design Lord, Child of Thor

    Hi,

    Just wanted to jump in here and say i’m also dealing with this problem, why do developers think its acceptable to add fonts like this to a website?

    It causes enormous problems with speed – i’ve just had to weed through and remove 4 Google font enqueues thats not nessacary. Thats ontop of the 4 fonts this customer already has on the site.

    On that note purely I will be advising the customer to remove the plugin, the other scripts that are added to every page really arnt needed either and i’ve had to remove them.

    I would strongly advise updating the plugin to call scripts / styles only when needed and allowing Google fonts to be turned on / off. It would do all of its users a massive favour.

  • Adam
    • Support Gorilla

    Hello SWS

    I hope you’re well and thank you for your feedback!

    I can certainly see the point, it’s just that we really had to take care of some other things as well. I have just checked the status of this and I can tell you that it’s already scheduled for a particular release so at least I can confirm that it’s definitely going to be there, quite soon. It won’t be (unless something changes, which might happen) the major 3.0 release but very soon after that. So, although I don’t have ETA, I can assure you that it’s going to be addressed quite soon.

    Kind regards,

    Adam

  • Mark
    • Design Lord, Child of Thor

    Exactly my point, we already have other 3rd party things being included and cannot be handled to manage speed performance in additional to them Hustle included two other google fonts which we are not using.

    I am hoping developers will take this request on high priority and implement in next update, it has already been 2 months.

  • Predrag Dubajic
    • Support

    Hi Mark,

    I got a stripped version from the devs that only includes the patch for google fonts, I have attached it below and to remove the fonts all you need to do is add this filter to your child theme functions.php file:

    function hustle_remove_google_fonts() {
    return false;
    }
    add_filter( 'hustle_load_google_fonts', 'hustle_remove_google_fonts' );

    Please note that this is beta version and you shouldn’t be using it on your live site until the public release is out.

    Best regards,

    Predrag

  • Predrag Dubajic
    • Support

    Hi Mark,

    Thanks for checking it, it seems that the above version changes the way that fonts are loaded in PHP and the filter mentioned above does stop them from loading, but there are still being imported via CSS.

    I’ve updated developers with this information so they can check it out and change this as well.

    Best regards,

    Predrag

  • Saskia
    • Flash Drive

    Hello there!
    We are in 2022 and there is a GDPR issue within the EU when loading Google Fonts. We must remove Google Fonts and be able to load those locally to avoid connection to Google’s servers when using plugins like Hustle Pro on our site here in the EU.

    Please escalate this issue to Devteam for legal reasons.
    Thanks
    Saskia

  • Arjay Lazaro
    • Acccounts and Billing - BL

    Hi Mark (and Saskia),

    Hope you’re doing well.

    We are pleased to inform you that we have very recently (in the past couple of hours) released the latest version for Hustle Pro – version 4.6

    Changelog:

    Enhance: Replace Google fonts with Bunny fonts for GDPR compliance

    The Typography Section allows you to set and choose the Font Family via the Custom Option or use the Default accordingly.
    [attachments are only viewable by logged-in members]

    Do let me know if you have further questions or inquiries. I will be glad to assist you.

    Best regards,
    Arjay L.

  • Oleh
    • Flash Drive

    Arjay Lazaro Hi, it appears that enabling the “Vanilla theme” option in the plugin still loads a significant amount of CSS that conflicts with our theme’s styles. Adding the ‘important’ declaration to our default styles to prioritize them over Hustle’s styles is not a good option. We’ve been encountering several issues with Hustle, and it’s becoming quite frustrating.

  • Oleh
    • Flash Drive

    I created the ticket and got this solution:

    “As I reported the issue to our Hustle Team to add some improvements in “Vanilla” mode in future, I also got some additional workaround for now from them.

    If you add this to your theme’s functions.php file

    add_filter( ‘hustle_disable_front_styles’, ‘__return_true’, 10, 2 );”

    It helped to prevent loading the styles, but the Roboto font is loading anyway.

  • Laura Zeballos
    • Staff

    Hi Oleh ,

    Thanks for the information. If you want also exclude the fonts you can use this snippet too:

    <?php
    
    add_action( 'wp_footer', function() {
    	if ( wp_style_is( 'hustle-fonts' ) ) {
    		wp_dequeue_style( 'hustle-fonts' );
    	}
    }, 11);

    Note that if you will add the snippet inside your theme functions.php or using a plugin you will need to remove the first line.

    Let us know if you require additional assistance.

    Best regards,
    Laura