Back

How to Remove Dashicons in WordPress to Improve Load Time

Spread the love

With millions of WordPress themes in the wild, it’s pretty difficult to find one that doesn’t have any Dashicons in it. While they are certainly useful to some users, they do slow down load time, sometimes significantly. Dashicons are part of the WordPress core, so code tweaks are required to remove dashicons in WordPress.

In this article, we’ll take a look at how to remove dashicons in WordPress programmatically to reduce load time while keeping all the benefits they provide to theme authors and users alike.

The Website Speed Optimization

Website Speed Optimization

Dashicons is a feature of WordPress that allows you to use icons in the WordPress admin area of your site. However, these icons are also loaded on the frontend of your site, which can slow down your page load time. That’s why it is good to remove the WordPress dashicons if you don’t use it.

As is the case with many modern themes and plugins, they may now be using their own icons or svgs. So, in most cases, you do not need WordPress dashicons on the front end of your website,

In optimizing your web page speed, you’ll notice that this CSS file is not huge, but there is no need to load it in the frontend for non-logged in users.

The Solution to remove dashicons (dashicons.min.css) from WordPress

In order to remove dashicons in the frontend of your WordPress site, you’ll need to add a little code snippet to your theme’s functions.php file. You can do this by going to Appearance -> Editor -> Theme Functions (functions.php).

Once you’re in the file, simply add this code:

function wpshapere_remove_dashicons_wordpress() {
  if ( ! is_user_logged_in() ) {
    wp_dequeue_style('dashicons');
    wp_deregister_style( 'dashicons' );
  }
}
add_action( 'wp_enqueue_scripts', 'wpshapere_remove_dashicons_wordpress' );

That’s it. The above code will remove dashicons WordPress for non-logged in users.

Conclusion

We hope you now understand how to remove dashicons from WordPress. We encourage you to try the above method and let us know if you have any questions in the comment box below.

You May also Read:

How to easily translate WordPress theme using Poedit to another language
How to Upload SVG to WordPress: 3 Workable Solutions
How to Fix file and folder permissions problem in WordPress

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *