How to disable Google Fonts in the Astra theme

astra theme templates

Loading fonts from Google Fonts can be a problem according to the privacy legislation in some countries of the European Union so sometimes it is convenient to deactivate them.

If you use the Astra theme and have this need the process is not complicated.

The first thing you have to do is to save the fonts locally in your server.

Once this is done the next step is to add this code to the functions.php file of the Astra child theme:

//Disable Astra Google Fonts add_filter('astra_google_fonts_selected', function($fonts) { return []; });
Code language: PHP (php)

Once this is done you can use the customizer to configure Astra to your liking. When you’re done take a look at the source code of the page to identify the Google Fonts that are loaded on the page.

chrome console fonts

All that’s left is to use the Google Webfont Assistant to generate the required CSS and download the font files you need. Add it to the child theme’s style.css file and your local Google Fonts will be loaded instead of the remote ones.

Read this post in Spanish: Cómo desactivar las Google Fonts en el tema Astra

Click to rate this post!
[Total: 1 Average: 5]

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top Skip to content