manager->get_control( $setting->id )->choices; return array_key_exists( $val, $choices ) ? $val : $setting->default; } public static function sanitize_sortable( $input, $setting ) { // Get list of choices from the control // associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; $input_keys = $input; foreach ( $input_keys as $key => $value ) { if ( ! array_key_exists( $value, $choices ) ) { unset( $input[ $key ] ); } } // If the input is a valid key, return it; // otherwise, return the default. return ( is_array( $input ) ? $input : $setting->default ); } public static function sanitize_select( $input, $setting ){ //input must be a slug: lowercase alphanumeric characters, dashes and underscores are allowed only $input = sanitize_key($input); //get the list of possible select options $choices = $setting->manager->get_control( $setting->id )->choices; //return input if valid or return default option return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } public static function sanitize_variants( $input ) { if ( is_array( $input ) ) { $input = implode( ',', $input ); } return sanitize_text_field( $input ); } } Businesswp_Customizer_Sanitize::get_instance();