Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Shortcodes::get_course_id()

Retrieve the course ID from within a course, lesson, or quiz


Description Description


Return Return

(int)


Top ↑

Source Source

File: includes/shortcodes/class.llms.shortcodes.php

	private static function get_course_id() {

		if ( is_course() ) {
			return get_the_ID();
		} elseif ( is_lesson() ) {
			$lesson = new LLMS_Lesson( get_the_ID() );
			return $lesson->get_parent_course();
		} elseif ( is_quiz() ) {
			$quiz = new LLMS_Quiz_Legacy( get_the_ID() );
			$lesson = new LLMS_Lesson( $quiz->assoc_lesson );
			return $lesson->get_parent_course();
		}

		return 0;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.7.9 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.