Hello,
I’m using a selct list that I populate myself this way :
function acf_file_field( $field ) {
$files = array('key1' => 'value1', 'key2' => 'value2');
$field['choices'] = array();
foreach($files as $file_key => $file_value) {
$field['choices'][$file_key] = $file_value;
}
return $field;
}
add_filter('acf/load_field/name=file', 'acf_file_field');
It displays fine, the value is correctly saved but the current value is not selected when I go back to my form.
Is there a way to force the selected attribute for the current value ?
Try setting the priority
add_filter('acf/load_field/name=file', 'acf_file_field', 20);