Remove Font Awesome from your WordPress theme

Many themes still automatically load Font Awesome icons and don’t 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.
Here’s how it works.

But first, let’s briefly explain what Font Awesome icons actually are; surely everyone has seen them at some point.

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 its name suggests, the icons look “awesome,” according to its own description 😉 In fact, it’s a very popular styling tool for animating or designing a website with icons.

Disable Automatic Loading of Font Awesome

Reasons for disabling automatic loading from a remote server might include improving performance and, of course, GDPR compliance.
First, you need to find out which handle is used to call the stylesheet.

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

To do this, look in the theme’s functions.php file. Search for the term font-awesome or fontawesome in connection with the wp_enqueue_style call. In our demo theme, the corresponding line was The $handle is therefore mh-font-awesome You can find more information about the wp_enqueue_style function in the wordpress.org code reference. Now, insert the following code into the child theme’s functions.php file to prevent it from 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' );
}

You can find more information about the wp_dequeue_style function in the wordpress.org code reference.

 

Request web hosting

Request your hosting account below!

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!