Home › Forums › Add-ons › Options Page › using options page fields in functions.php › Reply To: using options page fields in functions.php
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!
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.