apply_filters( 'learndash_ques_multiple_answer_correct_whole', boolean $correct, array $question_data, int|string $answer_index, mixed $correct_answer, array $user_response )
Filters whether the answer to the multiple type question is correct or not.
Description #
Parameters #
- $correct
-
(boolean) Whether the answer is correct or not.
- $question_data
-
(array) An array of question data.
- $answer_index
-
(int|string) Index of the answer.
- $correct_answer
-
(mixed) Correct answer for the question.
- $user_response
-
(array) An array of user response data.
Source #
Examples #
Note: Extended code example below not guaranteed, you may need to consult with a developer
<?php
/**
* Example usage for learndash_ques_multiple_answer_correct_whole filter.
*/
add_filter(
'learndash_ques_multiple_answer_correct_whole',
function( $correct, $question_data, $answer_index, $correct_answer, $user_response ) {
// May add any custom logic using $correct, $question_data, $answer_index, $correct_answer, $user_response.
// Always return $correct.
return $correct;
},
10,
5
);