Home › Forums › Add-ons › Repeater Field › update a acf sub_field with the value from a different sub_field › Reply To: update a acf sub_field with the value from a different sub_field
I tried:
function my_acf_post_fieldb($post){
$post_id = get_the_id();
$post_author_id = get_post_field( ‘post_author’, $post_id );
$field[‘readonly’] = 1;
$field_key = “field_573d8df4646da”;// field_key of repeater field
$value = array(
array(
“c_address1” => “Foo”,
“c_address2” => “Bar”
)
);
$field = update_field($field_key, $value);
return $field;
}
add_filter(‘acf/save_post hook’, ‘my_acf_post_fieldb’);
and it isn’t working either. The fields are not being populated with values.
What do I need to return out of the function? I tried return $post; it doesn’t work either.
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!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 8, 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.