Apply custom css for user role

To enqueue CSS in WordPress you can use:

  • wp_enqueue_scripts action for the frontend
  • login_scripts action for the login page
  • admin_scriptsaction for the admin side, as you already know

To check user’s roles you should get the user object and check the roles property. current_user_can() is function intended to check capabilities, not roles.

So, to add CSS based on user roles in the frontend:

add_action( 'enqueue_scripts', 'cyb_enqueue_styles' );
function cyb_enqueue_styles() {

    $user = wp_get_current_user();
    if( ! empty( $user ) && count( array_intersect( [ "seller", "partner" ], (array) $user->roles ) ) ) {
        wp_enqueue_style( 'my-style', get_template_directory_uri().'/some-style.css' );
    }

}