How to disable Google Fonts and Font Awesome in WordPress

Last updated December 6th, 2023 00:27

If you are among the group of people who create websites on the popular WordPress platform, then you have probably dealt with the issue of system speed at least once or more times. There are many online tools available for testing website speed. One of the most accessible options is Pagespeed Insight or GTmetrix. In this article, I would like to focus on how to disable Google Fonts and Font Awesome in WordPress. Since these are third-party services, WordPress downloads their parts and as a result, you are dependent on the speed of a server outside of your WordPress.

How to Disable Google Fonts and Font Awesome in WordPress

Every component of the system that needs to download external data slows down the system. Your system first needs to connect to a foreign server, download the data, and only then can WordPress process it. Such a situation can occur if you use Google Maps on your website, display feeds from Facebook or Twitter, or use Google Analytics for measurement. The latter service, Google Analytics, and Google Tag Manager can significantly slow down the system. You will see this in practically all measurement results.

Moreover, WordPress can download Font Awesome or For Eicons icons through the theme template. However, using a few lines of code inserted into the functions.php file can prevent this issue.

What is the functions.php file?

The functions.php file is a file in WordPress that plays a crucial role. For exapmle in modifying and extending the functions of this platform. This file is located in the root directory of the theme. Function.php includes functions that can be used for code modifications. The codes contained in the functions.php file can be used to add new functions, modify existing ones, or perform various code modifications.

The functions.php file is one of the most important files in WordPress because it allows users to quickly and easily customize WordPress to their needs. By using the functions.php file, you can easily extend WordPress with new features, which you will certainly appreciate when creating your own templates, plugins, or modifying existing functions.

Download Google fonts to your local FTP

As a first step, before disabling Google Fonts, you can download these fonts and use them from your own FTP. This means using the same storage as your WordPress website. It’s not necessary to describe the process of doing this again. You can find a complete article on this topic here: How to load Google fonts faster in WordPress.

Before deactivating Google Fonts, make sure to identify which fonts your template uses and try to upload them locally from FTP. If you are afraid of inserting codes into your website, many templates already offer font downloads manually from the template settings. Therefore, make sure to also check your template documentation.

Create your own Child theme

This is more of a recommendation than a requirement. A Child theme is a template derived from your primary template. To put it simply, you make a lightweight copy of the template you use, which you then set as the primary one. It’s called “lightweight” because it only contains key files necessary for the template to run, among which you can also include the aforementioned function.php file.

The advantage of a Child theme is huge. In general, if you add more code to the template files your WordPress uses, you risk losing your own codes every time the template is updated. This is because the files will be overwritten during the update, and your codes will disappear. The new file from the update will logically not contain your codes.

This problem is solved by using a Child theme. The principle is simple. WordPress uses Child themes and downloads the necessary data from the main theme. However, this theme has its own configuration files where you can add your own codes. During an update, only the files in the main theme are replaced, but your Child theme remains untouched.

You can find out how to create a Child theme here: What is a Child theme and how to create it. It’s very simple, and believe me, it will save you a lot of complications and time with potential future problems.

How to disable Google Fonts and Font Awesome in WordPress

And now, let’s get to the main goal of this article. How to disable Google Fonts and Font Awesome (or For Eicons) in WordPress? First of all, open the function.php file either on your FTP or using the integrated editor (if you haven’t disabled it yet). Look for the line // put some code here at the end of the file. Below it, insert the following codes that will deactivate the aforementioned services, and save the file. If you use a cache plugin, clear the cached files.

Google Fonts

					add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );

Font Awesome

					add_action('elementor/frontend/after_register_styles',function() {
	foreach( [ 'solid', 'regular', 'brands' ] as $style ) {
		wp_deregister_style( 'elementor-icons-fa-' . $style );
}, 20 );

For Eicons

					add_action( 'wp_enqueue_scripts', 'disable_eicons', 11 );
function disable_eicons() {
	wp_dequeue_style( 'elementor-icons' );
	wp_deregister_style( 'elementor-icons' );
Jak ve WordPressu zakázat Google Fonts a Font Awesome

How to disable Google Fonts and Font Awesome in WordPress


After saving the changes to the file, you can test the website speed to see if any part has been accelerated or not. Remember that you have probably cleared the cache, so it is good to wait a while before measuring until the page files are stored in the cache again. Otherwise, the measurement would be distorted because the cache would be missing, and the entire code would have to be generated as if the cache plugin was not enabled.

More content about WordPress

Whole category is here

The website is created with care for the included information. I strive to provide high-quality and useful content that helps or inspires others. If you are satisfied with my work and would like to support me, you can do so through simple options.

Byl pro Vás tento článek užitečný?

Klikni na počet hvězd pro hlasování.

Průměrné hodnocení. 0 / 5. Počet hlasování: 0

Zatím nehodnoceno! Buďte první

Jak užitečný vidíte tento článek.

Sledujte mě na sociálních médiích.

Je mi líto, že pro Vás nebyl článek užitečný.

Jak mohu vylepšit článek?

Řekněte mi, jak jej mohu zlepšit.


Subscribe to the Newsletter

Stay informed! Join our newsletter subscription and be the first to receive the latest information directly to your email inbox. Follow updates, exclusive events, and inspiring content, all delivered straight to your email.

Upozornit na
0 Komentáře/ů
Vložené zpětné vazby.
Zobrazit všechny komentáře.

Pokud mi chcete napsat rychlou zprávu, využije, prosím, níže uvedený
kontaktní formulář. Děkuji.

Další Kontaktní údaje