Hide the add learner box for non-admin users

In certain cases, you don’t want the teacher users to add learners to their courses. If you would like to hide the add learner meta box on the “learner management” screen.

Please note that this is a Developer level document. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our Support Policy.

add_action( 'sensei_learners_extra', 'custom_sense_disable_teacher_learner_add', 1 );
function custom_sense_disable_teacher_learner_add ( ){
// remove the learner add box for teachers
if( ! current_user_can( 'manage_options' ) ){
remove_all_actions( 'sensei_learners_extra' );

view raw
hosted with ❤ by GitHub