How to only deregister WordPress stylesheet for non-logged in users?

I use the following code in my functions.php to disable the dashicons.min.css file from the frontend. It works fine, but how can I use that action only for visitors, who are not currently signed in to WordPress?

The reason is that the WordPress admin bar at the top is broken, if the dashicons css file is not available.

add_action( 'wp_print_styles',     'my_deregister_styles', 100 );

function my_deregister_styles()    { 
   wp_deregister_style( 'dashicons' ); 
}

Related posts

1 comment

Comments are closed.