Created
March 25, 2021 08:49
-
-
Save BoyetDgte/5e4a7aa2ae9efcf89bdfecf569735cd0 to your computer and use it in GitHub Desktop.
Redirect to any page after LearnDash course is completed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('learndash_course_completed', 'course_completed', 10, 1); | |
function course_completed( $data ) { | |
$course_id = $data['course']->ID; | |
$slug_url = get_post_field( 'post_name', $course_id ); | |
if ($course_id) { | |
// After creating a "congrats" parent page and a child page with the same slug from the course. | |
// More info here https://www.radiocastvps.com/how-to-redirect-to-a-page-after-completing-a-learndash-course/ | |
wp_redirect(site_url("/congrats/$slug_url")); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment