Hi there! I think I’m having this problem too. I’m trying to set up a select field that’s dynamically populated from a repeater field on the Options page, pretty much exactly like this example:
Manually typing in select values, like so, works:
$field['choices'][ 'test' ] = 'Testing 1'; $field['choices'][ 'test2' ] = 'Testing 2';
But attempting to reference the option field using get_field() doesn’t work.
Edit: I originally tried calling add_filter() in functions.php, but, after some reading some posts here, then tried calling add_filter() inside an action on admin_init. I think the above code (manual choices) worked, but the option field values did not.
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!
© 2022 Advanced Custom Fields.