Performance PHP Beginner

Remove Dashicons for Non-Logged-In Users

Last updated: May 6, 2026

Dashicons is WordPress’s built-in icon font, used throughout the admin interface for menu icons, toolbar icons, and UI elements. WordPress also loads the Dashicons stylesheet on the front end of your site, because the admin bar, which appears for logged-in users, uses Dashicons for its icons. The problem is that WordPress loads Dashicons for every visitor by default, even those who are not logged in and will never see the admin bar.

For most sites, the vast majority of visitors are not logged in. They’re loading a stylesheet full of icons they will never need.

The Code

Add this to your functions.php or a site-specific plugin. It runs at priority 99, after all other scripts have been enqueued, and deregisters Dashicons entirely for non-logged-in visitors.

Why Deregister vs Dequeue

Using wp_deregister_style() rather than wp_dequeue_style() prevents Dashicons from being re-enqueued as a dependency. Some plugins enqueue their own stylesheets with Dashicons listed as a dependency, if you only dequeue it, those plugins can re-enqueue it. Deregistering removes it from the registry entirely so it cannot be loaded regardless of dependency declarations. This is appropriate for the frontend-only context where Dashicons genuinely is not needed.

Plugins That Use Dashicons on the Frontend

Some plugins deliberately use Dashicon classes for front-end icon elements, rating stars, social icons, or UI controls built with Dashicon characters. If any front-end element on your site stops displaying correctly after applying this snippet, it’s likely using a Dashicon character. The fix is to either inline the specific icon SVG used or load a lightweight alternative icon set for that component. Check your browser console for failed requests to the Dashicons font file to confirm this is the cause.

File Size Context

The Dashicons stylesheet is approximately 35KB minified, plus the associated woff2 font file at around 40KB. Removing it eliminates two HTTP requests and ~75KB of payload for every unauthenticated page view. On a site receiving thousands of daily visits, this is a meaningful reduction in bandwidth and rendering overhead.

functions.php
add_action( 'wp_enqueue_scripts', function() {
    if ( is_user_logged_in() ) return;
    wp_deregister_style( 'dashicons' );
}, 99 );

Built by Nahnu Plugins

Need something more powerful than a snippet?

Our commercial plugins go further, built for serious WordPress sites with full support, updates, and documentation included.

Browse All Plugins →

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only