Prevent Google fonts from being displayed in Astra theme

astra theme templates

One of the problems that appear with WordPress themes today is that they offer so many options and possible customizations that very few users resist the temptation to try and activate everything that is offered to them, it’s there isn’t it? it’s free isn’t it? then we must take advantage of it!

This also happens with the ability to use Google fonts to customize the look of the web, so modern themes, such as Astra, offer you in the customizer a huge list of Google fonts each one cooler and “different”, instead of the boring system fonts.

What’s wrong, is there a problem?

No, nothing, I am very much in favor of customization, and that everyone uses what he wants. Moreover, if we talk about the Astra theme, which you know I’m a big fan of, it even has settings for preloading fonts and even its own cache.

Why you should consider stop using Google Fonts

However, Google fonts have “their things”, and maybe you should think twice before using them…

  • They are served from Google servers, so you have to generate external requests to display the content. They can be preloaded, but even this is a resource consumption that you could be saving.
  • They can be deleted from Google’s font directory so that your website could be affected in appearance without you being able to avoid it or receive any notice that this has happened.
  • They are free to use but Google itself warns you to consult a lawyer.
  • They are subject to Google’s privacy rules, they use cookies and their use is analyzed, without details, so they are a problem in terms of privacy, especially for lack of knowledge of what Google does, what it analyzes, how it does it, etc..

But above all, for the user, it is not always a good decision to choose a peculiar, different source. The best option is always that your content is easily readable, and for this it is best to use fonts to which your visitors are accustomed, they have the eye trained to read them.

What are the advantages of using system fonts?

On the contrary, the system fonts have advantages that make their use advisable:

  • They are already installed on the computer of your visitors, so the visualization of your content is immediate.
  • We are used to reading with those fonts, so reading will be natural and easy.
  • They do not store user information or anything like that.

How do I prevent someone from activating Google fonts using the Astra theme?

If you are already decided let’s get down to business, and to avoid the occasion, let’s avoid the temptation by hiding the possibility of using Google fonts, simply by making them not appear in the list of fonts in the Astra theme customizer.

Just add the following to the functions.php file of the child theme:

/* Don't show google fonts */ add_filter( 'astra_google_fonts', '__return_empty_array' );
Code language: PHP (php)

Save the changes and there will no longer be even the option to select them, as they will be removed from the list. When changing the font family of any element, only the system fonts will be available for selection, and only the name of Google will remain, with no fonts to select.

How useful was this post?

Click on a smiley to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

Leave a Comment

Your email address will not be published.

Scroll to Top
Skip to content