[Fix] Elementor always loads Roboto google font

2 minute read
0
[Fix] Elementor always loads Roboto google font

By default, the Elementor plugin includes font files that are rarely used by users.

These fonts are “Roboto” and “Roboto Slab”. This default option makes your site slower because it requires your site to connect to Google servers and download these two fonts foe every visitor of your website. If your site or the theme on which your site is built have their own ways to manage typography or you do not use Roboto in the design of your site the fonts will be loaded anyway and it will slow the site performance. 

This bug is known, more details can be found on follow link:Elementor always loads google font Robotor · Issue #4075 · elementor/elementor (github.com)

The plugin developers still haven’t provided their users with the fix https://github.com/elementor/elementor/issues/16023

There are a couple of ways to solve this issue:

Remove the loading via code modification

You need to disable the font requests in the Elementor plugin. Add the following code into the functions.php in theme root:

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

Using the child theme, in this case, is highly recommended.

Via Elementor plugin settings

These two fonts are specified in Global Fonts | Elementor by default. To disable them you need to adjust the 4 main options and specify “Default” for the “Family” field.

P.S. For theme developers

As a theme developer you can control that options from your code. This setting are stored in the ” elementor_scheme_typography “ database field. So you can reset that option when your theme will be installed and avoid your customers from loading this fonts.

Here is a small snippet for that:

function theme_prefix_default_elementor_options() {
	update_option( 'elementor_scheme_typography', 'a:4:{i:1;a:2:{s:11:"font_family";s:0:"";s:11:"font_weight";s:0:"";}i:2;a:2:{s:11:"font_family";s:0:"";s:11:"font_weight";s:0:"";}i:3;a:2:{s:11:"font_family";s:0:"";s:11:"font_weight";s:0:"";}i:4;a:2:{s:11:"font_family";s:0:"";s:11:"font_weight";s:0:"";}}' );
}
add_action( 'after_switch_theme', 'theme_prefix_default_elementor_options' );

So, hope that help you !

Sign In
Lost your password?
Lost Password

Thanks for registration!

We just send you an Email.
Please Open it up to activate your account.

Sign Up
I agree to Privacy Policy