Home › Forums › Backend Issues (wp-admin) › acf/load_field filter question › Reply To: acf/load_field filter question
Actually, yes, it’s because of the repeater. As soon as I put the select field in a repeater it behaved the same way for me.
Here’s how to fix it. Before returning the fields update the field and this will force ACF to save the new choices in the database.
add_filter('acf/load_field/key=field_56abbdb4d9be3', 'dynamic_select');
function dynamic_select($field) {
//echo '<pre>'; print_r($field); echo '</pre>';
$field['choices'] = array(
'a' => 'A',
'b' => 'B',
'c' => 'C',
'd' => 'D'
);
// save new field settings to db
acf_update_field($field);
return $field;
}
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.