Hide WordPress toolbar from users except for admin and instructor

1. Install Child Theme (Dashboard >> Course Builder >> Child Themes).

2. In the functions.php file of the child theme, put the following code:

$user = wp_get_current_user();
if ( in_array( 'instructor', (array) $user->roles ) ) {
} elseif ( in_array( 'administrator', (array) $user->roles )) {
show_admin_bar(true);
}elseif ( in_array( 'lp_teacher', (array) $user->roles )) {
show_admin_bar(true);
} else {
show_admin_bar(false);
}