Add a ‘Quiz Results’ tab with the quiz notifications plugin.

A tab can be automatically inserted on every course, lesson, topic or quiz page.

If you find it time consuming to insert our Last Quiz shortcode on to every course, lesson, topic and/or quiz page. And you are OK with the last quiz results being inserted automatically, use the snippet below.

LearnDash has a useful snippet called “LearnDash Content Tabs Filter” that adds a Content tab dynamically on a course page. You could easily use the materials tab in your course settings, but if you want to do this dynamically and forget about it. Why not use code. However with a little modification to the existing code you can personalize it for a specific Use Case.

If you are using our “Quiz Notifications for LearnDash Plugin” then the following modified code might be just what you need. The snippet below will add a ‘Quiz Results’ tab that will include output from our [elc_last_quiz ...] shortcode, into every course, lesson, topic and/or quiz page.

When will the Quiz Results Tabs display?

  1. The Quiz Results Tabs will be visible after a user completes a Quiz.
  2. Quizzes need to be associated with a Course, Lesson or Topic page.
  3. After a quiz is successful, the user will continue to their next step. When they return to the lesson or quiz, the new Tab will be visible.

How to use the code?

  • Insert the following code in your themes custom functions.php file or use a plugin called “Code snippets”.
  • A basic knowledge of PHP is required to modify the code.
 * Example usage for learndash_content_tabs filter.
 * @SEE:
 * This snippet will add the tab with Last Quiz shortcode output on all: course, lesson, topic pages,
 * provided there are quiz results. 
	function ( $tabs = array(), $context = '', $course_id = 0, $user_id = 0 ) {

		// Add optional logic to show the custom tab only on certain courses.
//		if( 123 !== $course_id ) {
//			return $tabs;
//		}

		// List of content types to show the Tab and the Last Quiz. 
		// You can comment or uncomment content types for which the tab will be shown. 
		// Below will show the tab on lesson and topic pages only. 
		$elc_context = array(
//			'course',
//			'quiz',

		// If this is a post type we want to show Last Quiz, test if there is quiz results to render.
		if( in_array( $context, $elc_context ) ) {
			// Test for timespent only.
			$shortcode_atts = array(
				'show' => "timespent",
			$elc_test = elc_ldquiz_last_quiz_callback( $shortcode_atts );

		// Add our Custom Last Quiz Tab.
		if( ! empty( $elc_test ) && ! isset( $tabs[ 'lastquiz' ] ) ) {
			// show attribute values.
			// The quiz results will be printed in the order as in array.
			$show_ar = array(

			// Last Quiz shortcode attributes.
			$shortcode_atts = array(
				'show' => implode( ',', $show_ar ),

			// Get the HTML Last Quiz results.
			$elc_content = elc_ldquiz_last_quiz_callback( $shortcode_atts );

			// For print button uncomment line below.
			$elc_content = elc_ldquiz_print_callback( '', $elc_content );

			$tabs[ 'lastquiz' ] = array(
				'id'      => 'lastquiz',
				// The value here is to a CSS class you control to show an icon.
				'icon'    => 'ld-downloads-icon',
				'label'   => 'Quiz Results',
				'content' => $elc_content,

		// Always return $tabs.
		return $tabs;