Restrict instructors from accessing WP Admin panel

NO LONGER REQUIRED, ENABLE SWITCH WP ADMIN – WPLMS – BUDDYPRESS – HIDE ADMIN BAR

Add below code in child theme functions.php file or WP Admin – Plugins – Editor – WPLMS Customizer – wplms_customizer.php

Refer WP tutorial : https://codex.wordpress.org/Plugin_API/Action_Reference/admin_init

function restrict_admin_with_redirect() {
  
    if ( ! current_user_can( 'manage_options' ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) &&  $_GET['type'] !='upload'  ) {
        wp_redirect( site_url() );
        die();
    }
}
  
add_action( 'admin_init', 'restrict_admin_with_redirect', 1 );