Support

Account

Home Forums Backend Issues (wp-admin) Pre populate repeater in a flexible content Reply To: Pre populate repeater in a flexible content

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