Home Forums Add-ons Repeater Field Multiple fields -> to repeater field with subs Reply To: Multiple fields -> to repeater field with subs

  • When you move a field into a repeater you are effectively changing the field name. The old data is in the DB under the old name, for example "name", and you can continue to get the value using get_field('name') however, this is no longer the real name of this field and you cannot get values added in the repeater in the same way. Your new repeater field needs to use a have_rows() loop and use get_sub_field('name') to get the values

    ACF does not move the content stored in existing fields when the field names are changed, or moved into or out of repeaters, which is basically the same thing. The reorganization changes the field names.

    You would need to build code to do this moving and you would also need to build code to check it.

    For example, in your template where you are showing these values you would need to do something like

    if (have_rows('repeater')) {
      // values have been added to the repeater
    } else {
      // nothing in repeater
      // look in the old field names

    In the admin you can use an acf/load_field filter on the repeater In this filter you can do the same checking. If the value of the field is empty then get the values from the old field and dynamically populate the first row of the repeater with the old values. You could also create an acf/save_post action that would delete the old values using delete_post_meta().