1.
learndash_course_completed
Redirect completed students to a custom thank you page.
Use case: LearnDash normally keeps students on the course page when they complete it. This redirect snippet routes them to a congratulations landing page, a survey form, or an upsell offer.
add_action('learndash_course_completed', 'ppunch_redirect_on_course_complete', 10, 1);
function ppunch_redirect_on_course_complete($data) {
// Define the custom landing page URL here
$target_url = home_url('/course-complete-thank-you/');
// Perform redirect if this is a standard browser request
if (!wp_doing_ajax() && !wp_doing_cron() && !empty($target_url)) {
wp_safe_redirect($target_url);
exit;
}
}
When the course completed hook fires, this script pulls the completion data and performs a safe WordPress redirect to your custom target page.