title: Wordpress & Learndash - Course Redirection Filter via PHP code
body: <p>I'm very new to PHP programming, and I'm completely stumped by what is likely a very easy piece of code.</p>
  
  <p>I have built a website using Wordpress and Learndash LMS to sell online courses. One of the courses has two quizzes; One in the middle of the course, and one at the end of the course.</p>
  
  <p>Due to the limitations of Learndash, I am not able to add the quiz after a lesson. Or if I do, there is a "Mark Complete" button that essentially would allow a student to skip the quiz, which I do not want them to do.</p>
  
  <p>The solution I found was a php filter provided by Learndash:</p>
  
  <pre><code>add_filter("learndash_completion_redirect", function($link, $post_id) {
  
  //You can change the link here
  
  //$post_id is ID of the lesson/quiz from where the user is being redirected from. $link is the link to which the user is redirected from.
  
  return $link;
  }, 5, 2);
  </code></pre>
  
  <p>However, I have no idea how to make this filter work.</p>
  
  <p>Where do I put the links, but also what do I write as code to make it work?</p>
  
  <p>For example, when a student completes Lesson 10 on the course and the link is "<a href="http://course.com/lesson10" rel="nofollow">http://course.com/lesson10</a>", I want this filter to take the student to Quiz 1 "<a href="http://course.com/quiz1" rel="nofollow">http://course.com/quiz1</a>"</p>
  
  <p>Again I'm very new to PHP programming, so if I haven't been completely clear on my explanation I apologize and will add any additional information if needed.</p>
  
  <p>Assistance would be greatly appreciated, thank you.</p>