How to remove Google Fonts from Divi, Genesis and more themes

As you surely know, there are many, many themes that load Google Fonts , sometimes in excess, but you have to understand it, and it is that for a theme developer it is very convenient to load fonts from Google to make their theme more visually attractive, without having to host them on the subject, reducing its weight. Now this has a problem, or several.

Google Fonts and the WPO

If you have analyzed your website in any optimization and speed measurement service, you will have seen that they detect the load of external resources from Google Fonts as a problem . This is because they are external calls that your website makes to finally display its content, from resources that do not always have to be available , and yes, it is a problem. You’d think the hell if they’re from Google, they’ll load fast! But what if Google deletes that source tomorrow because of a problem with rights, profitability, or whatever? And it’s only an example. It can also happen that the servers where the Google Fonts are hosted have loading delays for any reason, which would affect the loading of your website, as there would be resources that would never finish showing / loading. So it’s best to host fonts locally, or not load them from Google Fonts .

Google Fonts and privacy

In case you did not know, it turns out that if your theme uses Google Fonts you are sharing the IPs of your visitors with Google . Come on, Google does not miss the opportunity to obtain information about our uses of the Internet at any time. And of course, if you are committed to privacy, let alone since the appearance of the RGPD , you should either inform your users in your privacy policies that this is happening, or simply avoid the loading of Google Fonts on your website, and that show with user system fonts.

How do I disable the loading of Google Fonts?

If you have it clear, we will see how to prevent the loading of Google Fonts , and consequently the recovery of private data of your visitors (IPs) with Google. What we will do, both for Divi and for any other theme , is to use the WordPress wp_dequeue_style function, with which we will avoid the Google Fonts loading of the theme’s CSS stylesheet . For this we need to know the name to include in the $handle of the function, and here is a list of the most used themes:

Theme Style sheet name with Google Fonts ($ handle)
Twenty Twelve twentytwelve-fonts
Twenty Thirteen twentythirteen-fonts
Twenty Fourteen twentyfourteen-fonts
Twenty Fifteen twentyfifteen-fonts
Twenty Sixteen twentysixteen-fonts
Twenty Seventeen twentyseventeen-fonts
Genesis Sample genesis-sample-fonts
Extra extra-fonts
Divi divi-fonts

Once we know the function to use and the $handle we just have to add our code to the functions.php file of the active theme, like this:

 // Remove Google Fonts from Divi theme
add_action ('wp_print_styles', 'ft_dequeue_divi_fonts_style');
function ft_dequeue_divi_fonts_style () {
      wp_dequeue_style ('divi-fonts');
}

In the above example we are avoiding the loading of Google Fonts in Divi. For you to see another example, in Genesis it would be like this :

 // Remove Google Fonts from Genesis Sample theme
add_action ('wp_print_styles', 'ft_dequeue_genesis_fonts_style');
function ft_dequeue_genesis_fonts_style () {
      wp_dequeue_style ('genesis-sample-fonts');
}

Easy huh?

Do you prefer to use a plugin?

If you don’t dare with the code, you can also use a plugin like Disable Google Fonts , but only if your theme is one of these: Twenty Twelve, Twenty Thirteen, Twenty Fourteen, Twenty Fifteen, Twenty Sixteen, Twenty Seventeen.

How do I host Google Fonts locally?

Another possibility, of course, would be to locally store the Google Fonts that your theme uses. In this way, you fully maintain the aesthetics of your theme while respecting the privacy of your visitors from Google. In this case, the process goes through downloading the Google fonts, hosting them on your server and changing the internal calls of the style sheet, so that they point to the new address where the fonts are, as we have already seen. It is somewhat more complicated but a good solution in any case.

( 10 votes, average: 4.9 ) Rate this article to help improve the quality of the blog
Share on Twitter Share on Facebook Share on Pocket Share on LinkedIn Share on WhatsApp Share on Telegram

Did you like this article? You can’t imagine what you’re missing on YouTube !

About Us

We are BE OF THEM, a team specialized in the field of digital marketing and programming, our headquarters is in Germany, and our activity has expanded to reach all parts of the Middle East, especially the Arab Gulf countries.

Do you need to raise your site's score?

We have the perfect solution for marketing your business

Contact Us

Call us, or message us by email & whatsapp

We will be happy to talk to you, and knowing everything about your work.

All rights reserved, © 2021