Home › Forums › Feature Requests › Default value for the taxonomy field type › Reply To: Default value for the taxonomy field type
I just tried this and the example I gave still seems to be working.
This if for checkbox/multiselect field type
add_filter('acf/load_field/key=field_589c6d5477f05', 'set_tax_default');
function set_tax_default($field) {
$field['default_value'] = array(3,4);
return $field;
}
and this works for radio and single select
add_filter('acf/load_field/key=field_589c6d5477f05', 'set_tax_default');
function set_tax_default($field) {
$field['default_value'] = 3;
return $field;
}
The value needs to match the term ID(s) of the default values you want to set.
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.