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?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U
— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.