Home › Forums › Bug Reports › Update field for multiple choose with array › Reply To: Update field for multiple choose with array
Ok i find the issue,
for valid the update field, we must return only the value (get_field without format), like :
$arr = array(
"0" => "test1",
"1" => "test2"
);
Then the core ACF will save the field correctly with value.
But, i use the get_fields() in my API, then the developper of APP from my WordPress, return all fields with value/label, so i must modified the core of ACF.
like :
includes\fields\class-acf-field-select.php – line 526
if( is_array($value) ) {
//$value = array_map('strval', $value); // OLD // remove array and up the value in parent array
// will print the array and select only the value
foreach ($value as $key => $val) {
// check if have more 2 characters, some field return 1 letter :/
if ( strlen($val['value']) > 2 ) {
$value[$key] = $val['value'];
} else {
$value = array_map('strval', $value);
}
}
}
That quick code is used for select field and checkbox field.
Can you add some filter for help developper ?
thanks,
Best Regards, Mat.
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.