Possibly a duplicate of:
We’re seeing very similar behavior.
Our project was never upgraded from 4x, everything has been done in ACFPro.
I upgraded to 5.0.8, but that didn’t resolve it.
Everything looks ok on dev where the JSON is generated
But in the edit screen the fields are duplicated
We’re loading the fields from JSON.
Here is a gist of the json file for that field group:
We think this may have to do with duplicating fields and moving them to another group.
Inspecting the editor showed us that the duplicated fields on the edit screen have the same slugs, but different ids
In this case, what’s showing up on the post editor is a set of fields we duplicated from another group.
i.e. we get two fields named jv_subheading, but one is field_542228e1ac753
and the other is field_54206f572fbf5
On staging/production – where I pulled the first screenshot from, we’re only loading the json files.
edit: We have disabled the ACF admin screens in that environment, so the 2nd screenshot above is from my local dev instance.
JSON files are included in our theme and under version control.
Are you able to check the DB
wp_posts table for any rows where the
post_excerpt cell contains the field’s name (main_title, etc)?
Do any field rows exist? You can also try searching for rows where the post_type = ‘acf-field’.
If you find any rows, perhaps consider deleting these to remove the duplicates.
If no rows are found, the duplicated fields must exist somewhere else. Please search your websites files for the field name / field key and see where it pops up. Perhaps there is another json file?
Thanks for your help.
Definitely nothing in the db.
Digging into the json – the repeater’s field ID seems to be duplicated in two of the field group json files.
Is it possible to adjust without losing the content that has already been loaded?
The sub-fields of the repeater are unique across both field groups.
Awesome, that explains the issue.
You will need to change one of the repeater’s keys, and make sure that any sub fields which have a parent value also update the key to match (may not be necessary in the output .json)
get_field() wont be able to find the field settings for the repeater field’s value, and won’t return a nice array of data. There are 2 solutions for this:
1. Edit all posts and re-save them. This will update the field reference for each value
2. Edit the DB
wp_postmeta and find/replace any occurrence of the field_key (found in meta_value column). This will also damage the other repeater field, so perhaps don’t do this method 🙂
Hope that helps.
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!
© 2019 Advanced Custom Fields. Subscribe