Support

Account

Home Forums ACF PRO Field Groups Automatically Duplicating on Save

Solving

Field Groups Automatically Duplicating on Save

  • I just ran into an issue when using ACF PRO v5.2.8. I was attempting to update some fields programmatically with update_field(), it seemed to work, but then a new issue arose immediately after.

    Now, when I try to update or create new field groups, the field group gets duplicated. This happens with existing field groups and when I try to create new ones. For example:

    1. I go to Custom Fields > Field Groups
    2. I click Add New
    3. I name the field group “Tester”
    4. I add a test text field named “Tester”
    5. I click Publish
    6. The page refreshes and the “Tester” text field is gone
    7. I return to the Custom Fields > Fields Group list
    8. I now have two fields groups called “Tester”, one has zero fields, and the other has one field.
    9. When entering either of them to update them, saving it creates a third/fourth/ etc. set.
    10. These fields are not updatable on the post they were assigned to.

    This is what I end up with after the first attempt:

    Screenshot

    I’ve tried deleting the field groups and recreating them. I’ve replace all of my ACF PRO files and still have the same issue. Any ideas on why this is happening? And why it started happening after attempting a manual update_field() call?

  • Is the code you created for updating fields still in place? If it is remove it, there is probably something in that code that’s creating a problem.

  • Hey, I removed that updating field code immediately after and the problem persisted.

    I found a random unrelated chunk of code that was causing the error. I don’t know why it is causing it though. I don’t know if it’s the unrelated code’s fault, or ACF’s fault, or some strange interaction between the two.

    Any time I run wp_insert_post() or wp_update_post() on a page load that occurs within WP Admin, the issue I described shows up. When I deleted all calls to those, everything worked again. I am using them to sync a post type to an external API. Perhaps those two functions require an attachment to a special hook that I’m not using? Any thoughts on that?

  • What causes the code that calls wp_insert_post() or wp_update_post()?

    What about the code itself that’s causing it. If you post that and the action hook that’s calling the function I might be able to see why it might be doing it.

  • Is there an update on this issue? Having the exact same problem for a long time. Using version 4.x now, which works. 5.x doesn’t.

  • This issue is not present in the current version of ACF5. You need to look at the possibility of other plugins or something in the theme that’s causing the issue. If not that then something on your server. If you can remove all other plugins and change to a default theme. Narrow down what’s causing the issue and then someone might be able to help you figure out why it’s happening.

  • The theme caused the issue.

    I used the filter “wp_insert_post_data”, which causes ACF to fail. I used the filter with a priority of 99, maybe this is to high (didn’t tested it).

    See here:
    https://support.advancedcustomfields.com/forums/topic/fields-disappear-after-save/

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

The topic ‘Field Groups Automatically Duplicating on Save’ is closed to new replies.