Hi!
I have a relational custom field, which shows all post objects from a specific custom post type.
When I hook using acf_load_field it doesn’t come with choices value.
This is the code I’m using (When I try this with a simple select, instead of relational, it works!):
add_filter('acf/load_field/key=field_544ee594ab0d6', 'my_acf_load_field');
function my_acf_load_field( $field )
{
echo '<pre>';
print_r($field);
echo '</pre>';
$field['choices'] = array(
'custom' => 'My Custom Choice'
);
return $field;
}
This is the output of print_r:
Array
(
[key] => field_544ee594ab0d6
[label] => Paciente
[name] => paciente
[_name] => paciente
[type] => post_object
[order_no] => 1
[instructions] =>
[required] => 1
[id] => acf-field-paciente
[class] => post_object
[conditional_logic] => Array
(
[status] => 0
[rules] => Array
(
[0] => Array
(
[field] => field_544ee541ab0d5
[operator] => ==
[value] => tomografico
)
)
[allorany] => all
)
[post_type] => Array
(
[0] => paciente
)
[taxonomy] => Array
(
[0] => all
)
[allow_null] => 0
[multiple] => 0
[field_group] => 522
)