Browse: Home / Hooks /

learndash_fetch_quiz_questions

apply_filters( 'learndash_fetch_quiz_questions',  array $pro_questions,  int $quiz_id,  boolean $random,  int $max )

Filters pro quiz questions list.


Description #


Parameters #

$pro_questions

(array) An array of pro quiz question IDs.

$quiz_id

(int) ID of the quiz.

$random

(boolean) Whether to fetch questions in random order.

$max

(int) The maximum number of questions to be fetched.


Source #

File: includes/lib/wp-pro-quiz/lib/model/WpProQuiz_Model_QuestionMapper.php


Examples #

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

 <?php
/**
 * Example usage for learndash_fetch_quiz_questions filter.
 */
add_filter(
	'learndash_fetch_quiz_questions',
	function( $pro_questions, $quiz_id, $random, $max ) {
		// May add any custom logic using $pro_questions, $quiz_id, $random, $max.

		// Always return $pro_questions.
		return $pro_questions;
	},
	10,
	4
);
 

Changelog #

Changelog
Version Description
2.6.0 Introduced. Used in fetchAll method of WpProQuiz_Model_QuestionMapper class to fetch all pro quiz questions.