Support

Account

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;
    }