Home Forums Add-ons Options Page Using acf/load_field to populate values? Reply To: Using acf/load_field to populate values?

  • First, before you run into other issues, your field keys must start with "field_". You will have issues with using "subfield_". This is in the documentation, but not prominent.

    What you want to do is use an acf/load_value filter applied to the repeater. First test to see if the value is empty. If the value is an array then values have already been saved to the field. If the value is empty then nothing has been saved yet and you can populate the repeater.

    To populate the repeater with defaults you need to construct an array for the repeater values using the field keys.

    $repeater = array(
      // nested array for each row
        // field key => value pairs for each sub field
        'field_12345' => 'value for the sub field',
        'field_34567' => 'value for the sub field'
      // start next row

    Let me know if you have any questions.