Dashicons is the official WordPress icon font introduced with WordPress 3.8. The style file dashicons.min.css is loaded in the frontend, which is unnecessary for most pages. It is needed in the backend for the dashboard icons.
If you do not use dashicons on your pages or posts. Then you can disable the loading of the file. This will improve the performance of your site.
Here we present a small snippet that you need to place in your function.php file. This will remove the dashicons stylesheet from the frontend on your page. In the WordPress administration everything works with it as before.
/** Remove Dashicons for non logged in users **/
add_action('wp_print_styles', 'cw_remove_dashicons', 100);
/** Remove Dashicons stylesheet beeing loaded for not admin login pages **/
function cw_remove_dashicons()
{
if (!is_admin_bar_showing() && !is_customize_preview()) {
wp_dequeue_style('dashicons');
wp_deregister_style('dashicons');
}
}
That’s it! This should increase the performance of your website.