Home › Forums › General Issues › Pre-populating drop-down choices › Reply To: Pre-populating drop-down choices
It would work the same say, but you’ll need to convert the value returned from the other plugins textarea to an array of choices. This is a basic example of the code you’d use in the load field filter:
$values = get_value_from_kirki_toolkit(); // get the text value
$values = explode(',', $values); // split the string into an array
$values = array_map('trim', $values); // trim all the values
foreach ($values as $value) {
$field['choices'][$value] = $value;
}
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.