Support

Account

Forum Replies Created

  • I haven’t found a solution for this but I found another solution that fit my problem, with this code is possible to pre-populate nested fields with some default value:

    add_filter('acf/load_value/key=field_607879a1215fc',  'acf_load_default', 10, 3);
    function acf_load_default($value, $post_id, $field)
    {
    
      if ($value === false) {
    
        $value = array();
    
        $value[] = array(
          'field_6081eeaf5a418' => 'Example Title One',
        );
        $value[] = array(
          'field_6081eeaf5a418' => 'Example Title Two',
          'field_6081eeb75a419' => array(
            array('field_6081eebf5a41a' => 'Example Title Three'),
            array('field_6081eebf5a41a' => 'Example Title Four')
          )
        );
      }
    
      return $value;
    }
  • any suggestion on how to fix this?

Viewing 2 posts - 1 through 2 (of 2 total)