Having worked on the same site for the last week (WP 6.1.1 & ACF 6.0.6) I have encountered a problem this morning.
When creating a new top level field inside of an existing Flexible Content block and then saving the page it disappears on reload. This confused me for some time, but then I noticed it was saving the new field inside a sibling repeater field, but without either the field name or label retained. So I was just ending up with lots of blank fields inside a repeater.
I have tried this on another site running the same version of WP and ACF, but with a different host (as I initially thought it might be a memory issue) and the same problem persists. However it only seems to happen on blocks that have a large number of fields inside them. It did not occur on a block that only had a single repeater field inside it.
Also, it doesn’t matter what type of field is created, it will always save as a standard text field without any name or label.
Can anyone else replicate this? (Only seems to happen on Flexible Content blocks with lots of fields and at least one repeater.)
Interestingly I’ve just turned on field keys and the one I’ve just added has a key of “acfcloneindex”.
This seems to be where the problem lies, it’s adding that field key and that’s resulting in the placement/label/name not being saved and the new field being added to the end of the repeater. Presumably because it doesn’t know where else it should be?
There was an issue like this posted here but it was never resolved and I haven’t a clue what could cause it. https://support.advancedcustomfields.com/forums/topic/issues-with-field-group-editor/
Well it seems that suggestion there, to use the bottom button instead of the top button inside the flexible field to add child fields, is resolving the issue as far as being able to carry on working, but it’s not a permanent fix.
Also just to note, if using the top button the added field has a placeholder label of ‘New Field’ and a placeholder name of ‘new_field’ along with the ‘acfcloneindex’ key, instead of the expected empty fields with usual generated key when using the bottom button.
I’d be happy to supply the JSON file if you want to replicate it yourself?
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
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2023 Advanced Custom Fields.