apply_filters( 'learndash_ques_multiple_answer_correct_each', boolean $correct_item, array $question_data, int|string $answer_index, mixed $correct_answer, array $user_response )
Filters whether to correct the answer for a multiple answer type question or not.
Description #
Parameters #
- $correct_item
-
(boolean) Whether to correct the answer 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_each filter.
*/
add_filter(
'learndash_ques_multiple_answer_correct_each',
function( $correct_item, $question_data, $answer_index, $correct_answer, $user_response ) {
// May add any custom logic using $correct_item, $question_data, $answer_index, $correct_answer, $user_response.
// Always return $correct_item.
return $correct_item;
},
10,
5
);