Home › Forums › Bug Reports › Choice field "Other" Repeater Issue › Reply To: Choice field "Other" Repeater Issue
Hi Ria
Elliot here – ACF dev.
Thanks for the bug report.
I’ve got some code for you to test if that’s ok.
Can you please edit the file: fields/radio.php and replace the following function:
function update_value( $value, $post_id, $field ) {
// bail early if no value (allow 0 to be saved)
if( !$value && !is_numeric($value) ) return $value;
// save_other_choice
if( $field['save_other_choice'] ) {
// value isn't in choices yet
if( !isset($field['choices'][ $value ]) ) {
// get raw $field (may have been changed via repeater field)
// if field is local, it won't have an ID
$selector = $field['ID'] ? $field['ID'] : $field['key'];
$field = acf_get_field( $selector, true );
// bail early if no ID (JSON only)
if( !$field['ID'] ) return $value;
// update $field
$field['choices'][ $value ] = $value;
// save
acf_update_field( $field );
}
}
// return
return $value;
}
Try the problem again and let me know if it solves it.
Thanks
E
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.