Support

Account

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

  • I very well understand the futility of filtering–just call me Sisyphus.

    I’m making progress–I decided to simplify, and wrote this code that works on a page with a non-repeater ACF field:

    add_filter('acf/update_value', 'my_acf_update_value', 10, 3);
    function my_acf_update_value( $value, $post_id, $field ) {
    	$value .= ' added by filter';
    	return $value;
    }
    

    Then I tried on a page with an ACF repeater–>crash with “Warning: Invalid argument supplied for foreach() in … /plugins/advanced-custom-fields-pro/pro/fields/repeater.php on line 722”

    Can you point me towards how to make this work for both single fields and repeater subfields?

    Thanks!