Home › Forums › General Issues › Taxonomy field option Save Terms prevents the default category from saving › Reply To: Taxonomy field option Save Terms prevents the default category from saving
Hey, John!
I’m trying to do this:
add_filter('acf/update_value/name=categories', 'set_default_category', 9, 3);
function set_default_category($value, $post_id, $field) {
if (!is_array($value) || !count($value)) {
$value = array(get_option('default_category', 1));
}
return $value;
}
I know it triggers, and I know $value
has the id of the selected default category.
Yet, when the the post is saved, the category doesn’t show up.
Any tips?
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.