if ($answer['is_true'] == 'yes') { $true_option++; } if ($true_option > 1) { $answer['is_true'] = 'no'; } if ($count == 2 && $check_seconds_option) { $answer['is_true'] = 'yes'; } $wpdb->update($wpdb->learnpress_question_answers, array('answer_data' => maybe_serialize($answer)), array('question_answer_id' => $answer['id']), array('%s')); if ($count >= 2) { break; } } } elseif ($to == 'single_choice') { foreach ($question->answers as $answer) { if ($answer['is_true'] == 'yes') { $true_option++; } if ($true_option > 2) { $answer['is_true'] = 'no'; } $wpdb->update($wpdb->learnpress_question_answers, array('answer_data' => maybe_serialize($answer)), array('question_answer_id' => $answer['id']), array('%s')); } } } update_post_meta($question->id, '_lp_type', $to); } } LP_Question_Factory::init();