Home › Forums › Bug Reports › Radio Buttons don't retain choices on export/import › Reply To: Radio Buttons don't retain choices on export/import
No I don’t, but if you want to fix it sooner
in advanced-custom-fields-pro/api/api-helpers.php
Look for the function acf_decode_choices and replace it with the following code.
function acf_decode_choices( $string = '' ) {
// bail early if already array
if( is_array($string) ) {
return $string;
// allow numeric values (same as string)
} elseif( is_numeric($string) ) {
// do nothing
// bail early if not a string
} elseif( !is_string($string) ) {
return array();
// bail early if is empty string
} elseif( $string === '' ) {
return array();
}
// vars
$array = array();
// explode
$lines = explode("\n", $string);
// key => value
foreach( $lines as $line ) {
// vars
$k = trim($line);
$v = trim($line);
// look for ' : '
if( acf_str_exists(' : ', $line) ) {
$line = explode(' : ', $line);
$k = trim($line[0]);
$v = trim($line[1]);
}
// append
$array[ $k ] = $v;
}
// return
return $array;
}
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.