Is it possible to populate choices for the Taxonomy field type?
My use case. There are 10 Terms in the taxonomy but I only want to show specific 3 terms.
I have tried something like this
termId : termName
But it does not seem to work. Any suggestions?
Thanks
function my_acf_load_field_options( $field ) {
// Reset choices
$field[‘choices’] = array();
// Define your options
$options = array(
’31’ => ‘Term A’,
’29’ => ‘Term B’,
’44’ => ‘Term C’
);
// Add options to field choices
foreach( $options as $key => $value ) {
$field[‘choices’][$key] = $value;
}
// Return the field
return $field;
}
// Replace ‘company_nature_of_business_2’ with the actual name or key of your ACF field
add_filter(‘acf/load_field/name=taxonmoy_option’, ‘my_acf_load_field_options’);
I managed to resolve it, I have found this filter to do so.
acf/fields/taxonomy/wp_list_categories