LLMS_Student_Quizzes::get_last_attempt( int $quiz_id )

Retrieve the last recorded attempt for a student for a given quiz/lesson

Description Description

"Last" is defined as the attempt with the highest attempt number

Top ↑

Parameters Parameters


(int) (Required) WP Post ID of the quiz.

Top ↑

Return Return


Top ↑

Source Source

File: includes/models/model.llms.student.quizzes.php

	public function get_last_attempt( $quiz_id ) {

		$attempts = $this->get_attempts_by_quiz(
				'per_page' => 1,
				'sort'     => array(
					'attempt' => 'DESC',

		if ( $attempts ) {
			return $attempts[0];

		return false;


Top ↑

Changelog Changelog

Version Description
3.16.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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