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!
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 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.