Home Forums ConsultStreet Pro Error throwing – ConsultStreet_Customizer_Sanitize::get_instance(); Reply To: Error throwing – ConsultStreet_Customizer_Sanitize::get_instance();

#14100
Kim Pritchard
Participant

Error is last line of this PHP code.

/**
* Sanitize Radio Buttonset control.
*
* @param string $val The value to be sanitized.
* @param object $setting Control setting.
*
* @return string
*/
public static function sanitize_radio( $val, $setting ) {

// Radio key must be slug, which can contain lowercase alphanumeric characters, dash, low dash symbols only.
$val = sanitize_key( $val );

// Retrieve all choices.
$choices = $setting->manager->get_control( $setting->id )->choices;

// Ensure the value is among the choices. If fails test, return default.
return array_key_exists( $val, $choices ) ? $val : $setting->default;