Support

Account

Home Forums General Issues How to change repeater sub field name in db Reply To: How to change repeater sub field name in db

  • Is this just for aesthetic reasons? because you want it to be “book” instead of “books”. If that’s the case I would leave it alone because the field already has data in it. The sub field name really does not matter.

    Changing the sub field name in the DB will require changing every instance of the meta key in the DB. There are 2 entries in the DB for every field and all of them would need to be changed.

    
    // field meta key
    "{$repeater_field_name}_{$row_index}_{$sub_field_name}"
    // acf reference field
    "_{$repeater_field_name}_{$row_index}_{$sub_field_name}"
    

    There really is not a way to do a search and replace unless you to it for every potential row index and this would be messy and prone to errors.

    Like I said, if the reason you want to change it because you don’t like the way it looks the my suggestion is to leave it alone. I was just working on a site an noticed that I spelled a field name wrong, or I should say I spelled the label wrong and ACF added the field name based on that label. I copied and pasted the field name to my code and everything was working. I just changed the spelling on the label and left the name alone. The code is working and that’s really all that matters. Changing the field name would have been too much work.