To show the LearnDash continue button after a failed quiz, return true from the show_quiz_continue_buttom_on_fail filter (the hook name really is spelled "buttom"). LearnDash then shows the continue link on the result screen even when the score is below the passing score. There is a catch most snippets leave out: in LearnDash 4.18.0.1 that link sends a learner who has not passed back to the quiz page. If you want failed learners to actually move on, you also need to change where the link points, and that only works in a course whose progression allows it.
This article covers the whole LearnDash continue button failed quiz setup: the filter, where the link really goes and a second snippet that sends learners forward. Checked against the LearnDash 4.18.0.1 source and the hook's page on the official LearnDash developer site. LearnDash 5.x is the current release; we did not test these snippets on 5.x, so confirm the behaviour on staging after each update.
What the filter does
The filter is applied in the quiz result box template (quiz/partials/show_quiz_result_box.php, since 2.3.0.2) with two arguments: the default false and the quiz post ID. When it returns true, the template adds the class show_quiz_continue_buttom_on_fail to the quiz_continue_link container. When the quiz finishes, the front-end script (wpProQuiz_front.js) shows the continue link if the score reaches the passing percentage or that class is present.
LearnDash also applies the same filter when it builds the AJAX response for a completed quiz, with the quiz post ID as the second argument. In 4.18.0.1 the script reads the template class, so a callback that checks the quiz ID behaves the same in both places.
Snippet: show Continue after a fail
Put this in a small custom plugin or your child theme's functions.php. Use quiz post IDs, not the ProQuiz IDs shown in some older screens.
<?php
/**
* Show the LearnDash Continue link after a failed attempt on selected quizzes.
* Not run on a live site; test on staging first.
*
* @param bool $show Whether to show the link on fail. Default false.
* @param int $quiz_id Quiz post ID.
* @return bool
*/
function aiolms_continue_on_failed_quiz( $show, $quiz_id ) {
$quiz_ids = array( 123, 456 ); // Quiz post IDs to allow.
if ( in_array( absint( $quiz_id ), $quiz_ids, true ) ) {
return true;
}
return $show;
}
add_filter( 'show_quiz_continue_buttom_on_fail', 'aiolms_continue_on_failed_quiz', 10, 2 );
To enable it on every quiz, use add_filter( 'show_quiz_continue_buttom_on_fail', '__return_true' ); instead. We rarely recommend that: a pass mark that no longer gates anything usually means the quiz should not have one.
Where the Continue link goes after a fail
The link comes from learndash_quiz_continue_link(). It points at the quiz's own URL with quiz_redirect=1 and quiz_id added. On the next request, learndash_quiz_redirect() (hooked to wp) checks learndash_is_quiz_complete() for the learner. If the quiz is complete, the learner goes to the next step or the course completion page. If it is not, the learner goes back to the quiz.
A failed attempt does not complete the quiz, so with only the first snippet the learner sees a Continue button that reloads the quiz. That is fine if all you want is a visible way off the result screen. It is not fine if you expected the learner to move forward.
Snippet: send failed learners to the next step
The learndash_quiz_continue_link filter (since 2.1.0) receives the link HTML and its URL. This version swaps the URL for the next step in the course, using learndash_next_post_link(), but only for the same quizzes and only while the learner has not passed.
<?php
/**
* Point the Continue link at the next course step for learners who have not passed.
* Not run on a live site; test on staging first.
*
* @param string $link Continue link HTML.
* @param string $url Continue link URL.
* @return string
*/
function aiolms_failed_quiz_continue_to_next_step( $link, $url ) {
$args = array();
wp_parse_str( (string) wp_parse_url( $url, PHP_URL_QUERY ), $args );
$quiz_id = isset( $args['quiz_id'] ) ? absint( $args['quiz_id'] ) : 0;
if ( ! $quiz_id || ! in_array( $quiz_id, array( 123, 456 ), true ) ) {
return $link;
}
$user_id = get_current_user_id();
$course_id = absint( learndash_get_course_id( $quiz_id ) );
if ( ! $user_id || ! $course_id || learndash_is_quiz_complete( $user_id, $quiz_id, $course_id ) ) {
return $link; // Passed learners keep the normal completion redirect.
}
$next_url = learndash_next_post_link( '', true, get_post( $quiz_id ) );
if ( empty( $next_url ) ) {
return $link; // Last step in the course: keep the default.
}
return str_replace( esc_url( $url ), esc_url( $next_url ), $link );
}
add_filter( 'learndash_quiz_continue_link', 'aiolms_failed_quiz_continue_to_next_step', 10, 2 );
Two details matter here. First, the link is built when the quiz page loads, before the attempt, so the check uses the learner's state at that moment. A learner who passes on this attempt still goes to the next step, but skips LearnDash's own completion redirect. Second, LearnDash prints the link into a single-quoted JavaScript string, so the returned HTML must not contain raw single quotes. esc_url() encodes them, which is one reason to keep it.
Limits you need to know
- Linear progression still applies. With Course Progression set to Linear, the next step is locked until the quiz is complete. The learner reaches it and sees LearnDash's "Please go back and complete the previous" message. Moving past a failed quiz only works with Free form progression, or when the quiz is the last item that matters.
- Nothing is marked complete. The attempt is stored as failed. Course completion and certificates still follow the real result, and callbacks on
learndash_quiz_completedreceivepassas 0 in the quiz data. - The result box looks like a pass. When the class is present, the script adds
ld-quiz-result-passedto the result box and fires thelearndash-quiz-finished-passedJavaScript event. Custom CSS or tracking code that listens for those will treat a failed attempt as a pass. Check any analytics before you enable this.
Test it on staging
- Log in as a test learner enrolled in the course, never as an administrator.
- Fail the quiz on purpose and confirm the Continue link appears.
- Click it. With only the first snippet you should land back on the quiz. With both, you should land on the next step.
- Pass the quiz with a second learner and confirm the normal redirect still works.
- Repeat on a quiz that is not in your list to confirm nothing changed there.
For more on how LearnDash quizzes, progression and completion fit together, see our LearnDash guide. If you are weighing several changes like this, our LearnDash customisation cost article explains how we scope them.
How we can help
We build LearnDash quiz and progression changes as small, versioned plugins with tests, not as snippets pasted into a theme. See our LearnDash services and LMS plugin development, or contact us with the quiz flow you need.
Frequently asked questions
Why is the LearnDash filter called show_quiz_continue_buttom_on_fail?
It is a typo that has been in LearnDash since the filter was added in 2.3.0.2, and it was kept for backward compatibility. You must use the misspelled name or the callback never runs.
Why does Continue reload the quiz after a failed attempt?
The Continue link adds quiz_redirect=1 to the quiz URL. learndash_quiz_redirect() then sends learners who have completed the quiz to the next step, and everyone else back to the quiz. A failed attempt does not complete it.
Does showing Continue mark a failed LearnDash quiz as complete?
No. The attempt is still stored as failed, so course completion and certificates follow the real score, and code hooked to learndash_quiz_completed still sees the attempt as failed.
Can learners skip a failed quiz in a linear LearnDash course?
Not with these filters alone. Linear progression locks the next step until the quiz is complete. Use Free form progression for that course, or remove the pass mark from the quiz.
Free 30-minute consultation
Not sure where to start? Talk to an LMS engineer.
Tell us what platform you run and what you need. You’ll get honest, practical advice - even if the answer is that you don’t need us.
Sources & references
- show_quiz_continue_buttom_on_fail - LearnDash
- LearnDash LMS changelog - Nexcess (StellarWP)
- wp_parse_url() - WordPress.org
Learn more about this topic with AI
Gemini opens with the prompt copied - paste it into the chat to start.