Support

Account

Home Forums ACF PRO Duplicated Fields in Page Editor

Solving

Duplicated Fields in Page Editor

    • mattbeck

    • September 26, 2014 at 5:53 am

    Possibly a duplicate of:
    http://support.advancedcustomfields.com/forums/topic/duplicate-group-fields-on-edit-postpage/

    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
    ACF admin screenshot

    But in the edit screen the fields are duplicated
    ACF edi screenshot

    We’re loading the fields from JSON.

    Here is a gist of the json file for that field group:

    • mattbeck

    • September 26, 2014 at 6:24 am

    Followup:

    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

    • Elliot

    • September 30, 2014 at 10:21 am

    Hi @mattbeck

    Are you using JSON only, or do you also have the fields in the DB?
    If so, can you please delete the JSON file and test the issue again?

    The duplicate fields must exist somewhere, and once found, you can delete them.

    • mattbeck

    • September 30, 2014 at 10:29 am

    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.

    • Elliot

    • September 30, 2014 at 3:21 pm

    Hi @mattbeck

    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?

  • @elliot Condon

    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.

    Cheers,
    Matt

    • Elliot

    • October 1, 2014 at 12:31 pm

    Hi @mattbeck

    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)

    Unfortunately, the 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.

    Thanks
    E

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.