Browse: Home / Snippets /

Remove LearnDash content from user profile dashboard

Contents


Snippet #

Important: All snippets are provided as-is without support or guarantees. These snippets are provided as guidelines for advanced users looking to customize LearnDash. For any additional help or support with these snippets, we recommend reaching out to a LearnDash Expert.

add_action( 'admin_init', function() {
	global $sfwd_lms;
	
	// Removes 'User Enrolled in Courses’ and 'User Enrolled in Groups’ sections
	remove_action( 'load-profile.php', 		array( $sfwd_lms->ld_admin_user_profile_edit, 'on_load_user_profile') );
	remove_action( 'load-user-edit.php', 	array( $sfwd_lms->ld_admin_user_profile_edit, 'on_load_user_profile') );

	remove_action( 'show_user_profile', 	array( $sfwd_lms->ld_admin_user_profile_edit, 'show_user_profile') );
	remove_action( 'edit_user_profile', 	array( $sfwd_lms->ld_admin_user_profile_edit, 'show_user_profile' ) );

	// Remove the 'Course Info’ section
	remove_action( 'show_user_profile', 	array( $sfwd_lms, 'show_course_info' ) );
	remove_action( 'edit_user_profile', 	array( $sfwd_lms, 'show_course_info' ) );

	// Removes the 'Permanently Delete Course Data’ section
	remove_action( 'show_user_profile', 'learndash_delete_user_data_link', 1000 );
	remove_action( 'edit_user_profile', 'learndash_delete_user_data_link', 1000 );

}, 1 );