Remove MAXCDN link/load font awesome locally

Hi there BB Team -

I understand that font awesome can load locally, however I’m unable to remove the <link id=“font-awesome-css” href=“https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css” rel=“stylesheet” type=“text/css” media=“all”> via functions.php in my child theme without removing FA entirely.
For performance reasons, I want to load FA locally rather than across the CDN.

I’ve searched here and online and haven’t been able to find an exact answer.
Site: https://generic.ruzamdigital.com/

KR,

Sam

Hey Samuel!

You should be able to dequeue the CDN font-awesome by using the code below. Give it a shot and let us know how it goes.

function remove_unwanted_css(){
	wp_dequeue_style('font-awesome');
}
add_filter('wp_print_styles', 'remove_unwanted_css');

Jun

Thanks Jun.
I ended up doing it like this, after downloading the latest FA to a new folder called fonts:

function add_font_awesome2()
{
wp_enqueue_style( ‘style’, get_stylesheet_uri() );
wp_enqueue_style( ‘font-awesome2’, ‘/wp-content/fonts/css/font-awesome.min.css’ );
}
add_action( ‘wp_enqueue_scripts’, ‘add_font_awesome2’ );

function remove_unwanted_css(){
wp_dequeue_style(‘font-awesome’, ‘https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css’);
}
add_filter(‘wp_print_styles’, ‘remove_unwanted_css’);

End result: halved my average page loading time