Browse: Home / Snippets /

Enroll new user into multiple courses on registration

Contents


Snippet #

add_action( 'user_register', function( $user_id ) {

	// Comma separated array of course IDs
	// Go here if you don't know how to find Course ID: https://www.learndash.com/support/docs/faqs/find-course-id/
	$course_ids = [
		27922,
		27949,
	];

	// Add user to each course
	foreach ( $course_ids as $course_id ) {
		ld_update_course_access( $user_id, $course_id, $remove = false );
	}

});