I have a repeater and it has only one sub field, it is an image field, but I made a mistake, the repeater field name and its sub field names are same. Repeater field name : registers_book
Sub field name : registers_book
I need to replace the field names like
Repeater field name : registers_book
Sub field name : register_book
This is also need to change in all existing posts (Existing DB), How can i do this?
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
// acf reference field
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.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users