Support

Account

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?