Browse: Home / Snippets /

Enroll new user into multiple courses on registration

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( '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 );
	}

});