Home › Forums › Feature Requests › Default value for the taxonomy field type › Reply To: Default value for the taxonomy field type
I would say that you’ll need to go about setting the default value differently in this case. You’re using a custom taxonomy, so that should make things a bit less difficult since your not dealing with “Uncategorized”
Rather than using acf/load_field in this case you should use acf/load_value https://www.advancedcustomfields.com/resources/acfload_value/ with a priority > 10
Going to be honest, I’m not exactly sure what needs to be done, this is a bit of a guess.
add_filter('acf/load_value/key=field_58086a9b13be5', 'kiteboat_set_tax_default', 20, 3);
function kiteboat_set_tax_default( $value, $post_id, $field ) {
if ($value === false && get_post_status($post_id) == 'auto-draft') {
$value = 304;
}
return $value;
}
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.