Learndash : How to redirect a user after specific quiz completion?

learndash users

Learndash quiz is great , but this post is going to help all those admin who wants to redirect a user or learner to a specific page ( maybe bonus study material or a reward page ). Redirection is easily possible if you paste following code in the function.php.

But wait! Do not paste directly to function.php of the main theme. Use the child theme. Best way to use the code given below is to first install the WordPress plugin called –code snippets (search within wp plugin directory ) and the paste the code given below .

Code to paste in Code Snippet

add_filter("learndash_completion_redirect", function($link, $post_id) {
if ($post_id == "2240") {
$link='/bonus-1-1/';
return $link;
}

else {
return $link;
}

}, 5, 2);

you could also just add ‘or’ conditions into the function above, if ($post_id == “2240” OR $post_id == “2650” OR $post_id == “3456”)… like wise…the Redirection happens when user completes quiz with IDS either 2240 or 2650 or 3456……in case of other quizzes , redirection will not happen

Demo Video on Redirection After Specific Quiz in LearnDash

Comments are closed.