Support

Account

Home Forums Front-end Issues Is sanitization required for front end form? Reply To: Is sanitization required for front end form?

  • @sododesign I tested your function and I found an error.

    if ( ! function_exists( 'acf_wp_kses_post' ) ) :
    
    	function acf_wp_kses_post($data, $post_id=0, $field=array()) {
    	
    		if (isset($field['type']) && ($field['type'] == 'repeater' || $field['type'] == 'flexible_content')) {
    			// no need to run it on repeaters
    			// will be called again for each subfield
    			return $value;
    		}
    
    		if (!is_array($data)) {
    			return wp_kses_post($data);
    		}
    
    		$return = array();
    		if (count($data)) {
    			foreach ($data as $index => $value) {
    				$return[$index] = acf_wp_kses_post($value);
    			}
    		}
    
    		return $return;
    		
    	}
    	
    endif;
    
    add_filter('acf/update_value', 'acf_wp_kses_post', 10, 3);

    I use repeater fields at option pages. If I use this function, after clicking the update button, all values are lost and not saved.

    What is the reason for this issue?