Home Forums General Issues Filter field when saving Reply To: Filter field when saving

  • Thanks for the recursive example–it was just what I needed. Here’s what I came up with that works with non-repeater fields and repeater subfields:

    add_filter('acf/update_value', 'my_acf_update_value', 10, 3);
    function my_acf_update_value( $value ) {
    	if (!is_array($value)) {
    		$value .= ' added by filter';
    		return $value;
    	$return = array();
    	foreach ($value as $index => $data) {
    		$return[$index] = my_acf_update_value ($data);
    	return $return;

    There’s still something not quite right as ‘ added by filter’ appears twice on the 2 repeater subfields and saving the page is appallingly slow even on my local server. For my purposes (removing cruft from pasting text from MS Word), I can tolerate running the filter twice, but I’d like to cut the redundancy if I can. Any suggestions?