You can do this a number of ways, but here is how I did it:
1. Setup Congratulations Pages for Each Course
The first thing I did was create a parent page called Congratulations with the url of “/congrats.”
Then I created Child Pages, one for each course. Those pages looked something like this.
The most important thing I did was give each page the same slug as the course it is tied to. If I didn’t do this, then the next step wouldn’t work as coded.
2. Add This Code to Your Functions.php
The next step was to find the LearnDash hook that fires when a LearnDash course completes.
Luckily there is a learndash_course_completion_url hook that let’s return a URL and the redirect happens automatically.
This code gets the slug for the completed course and then creates a new URL string of “/congrats/course-slug.”
NOTE: This will only work if you you did these two things from Step 1.
- Create a parent page with the URL slug of “congrats”
- Create child pages for each course using the same URL slug as the course
Hope this Helps!
If you have a LearnDash account you can access the list of Action and Filter Hooks here. Since that page is password protected, thought I would share this snippet with you.
Hope it helps!