Remove Font Awesome from your WordPress Theme

There are still many themes that automatically load the Font Awesome icons and do not give users the option to prevent this.
If you don’t need the icons or prefer to load them locally, you should disable loading by the theme.
Below we explain how this works.

But first, we briefly explain what Font Awesome icons actually are, everyone has surely seen them before.

What is Font Awesome?

Font Awesome is the most widely used toolkit for vector icons that can be easily customized with CSS.
Among other things, you can change the size and color of the icons, add a drop shadow or use animated loading icons.
As the name suggests, icons look “awesome” according to their own description 😉 In fact, they are a popular style tool to spice up or design a website with icons.

Disable automatic loading of Font Awesome

Reasons to disable automatic loading from a remote server could include performance improvement and, of course, GDPR compliance.
First of all, you should find out which handle the stylesheet is called with.
To do this, look in the functions.php of the theme, you should look for the term font-awesome or fontawesome in connection with the call wp_enqueue_style In our theme for the demo, the corresponding line was

wp_enqueue_style('mh-font-awesome', "//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css", array(), null);

The $handle is therefore mh-font-awesome In the code reference of wordpress.org you can find more information about the function wp_enqueue_style Now, the following code should be inserted in the functions.php of the child theme to prevent loading:

// Dequeue Styles - Remove Font Awesome from WordPress Theme
add_action( 'wp_print_styles', 'dequeue_font_awesome_style' );
function dequeue_font_awesome_style() {
      wp_dequeue_style( 'mh-font-awesome' );
      wp_deregister_style( 'mh-font-awesome' );
}

In the code reference from wordpress.org you can find more information about the function wp_dequeue_style

 

Request a benchmark now

Do you feel like your website could be faster? Let us run a benchmark. We guarantee that your website will run faster on our hosting!