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:
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_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
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).
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.