Browse: Home / Hooks /

learndash_course_completion_url

apply_filters( 'learndash_course_completion_url',  int|string $next_quiz,  int $course_id )

Filters ID or URL of the next quiz of the course.


Description #


Parameters #

$next_quiz

(int|string) ID or URL of next quiz of the course.

$course_id

(int) Course ID.


Source #

File: includes/course/ld-course-progress.php


Examples #

Note: Extended code example below not guaranteed, you may need to consult with a developer

 <?php
/**
 * Example usage for learndash_course_completion_url filter.
 */
add_filter(
	'learndash_course_completion_url',
	function( $link, $course_id ) {
		// You can change the link here
		if ( $course_id == 123 ) {
			$link = get_permalink( 456 );
		} elseif ( $course_id == 456 ) {
			$link = get_permalink( 789 );
		}

		// Always return $link
		return $link;
	},
	5,
	2
);

add_filter(
	'learndash_course_completion_url',
	function( $link, $course_id ) {

		// Change $course_id to the completed course
		if ( $course_id == 33749 ) {

			// Change to the next couese ID
			$link = get_permalink( XXX );

		} else {

			// Change to a default redirect or you can add more course redirects later
			// Or don't change the value of $link to let the user return to the completed course URL
			$link = get_home_url();
		}

		return $link;
	},
	5,
	2
);
 

Changelog #

Changelog
Version Description
2.1.0 Introduced.