
Summary
When using a repeater with a conditional field, newly-added rows at the top inherit conditional field values.
- Only happens if “Block” or “Row” repeater layout is selected. Does not happen if “Table” repeater layout is selected.
- Does not happen when the “add row” button is used at the bottom.
- Only happens when the “plus sign” button is used at the top.
Steps to reproduce
- Use the attached json to import the field group. It should appear when editing a post. Or just make a repeater with (a) a true_false field, and (b) a field that depends on that field being toggled on using conditional logic. Repeater must have layout “Block” or “Row”.
- Add a new post
- VHS Collection > Add Row
- Check “Advanced Options”
- Subtitle: “a”
- Publish post
- Refresh edit screen
- Hover over “VHS Collection” -> click “Plus sign” to add an item above
- Update post
- Refresh edit screen
- Check “Advanced Options” of the newly created item #1 to reveal “Subtitle” field. It has value “a” even though a value was never entered for the “Subtitle” field of this item.
There are numerous posts about this on the forum.
This should happen with repeaters no matter the layout when sub fields are hidden by conditional logic. It has to do with fields that are hidden by conditional logic are not submitted or updated. Stray values in the database will be retained by the row index from when they were not hidden by conditional logic.
Here is one of the many old posts on this topic https://support.advancedcustomfields.com/forums/topic/acf-repeater-sub-fields-are-losing-swapping-content-when-re-ordered/