Remove Dashicons for Logged-Out Visitors
Stops the Dashicons icon font from loading on the front end for visitors, saving a request. Logged-in users still get it for the admin bar.
Opens WPIDE on
Code
add_action( 'wp_enqueue_scripts', function () {
if ( ! is_user_logged_in() ) {
wp_dequeue_style( 'dashicons' );
}
}, 100 );
Notes
If your theme uses Dashicons, they are still loaded as a dependency.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.