I didn’t find it in the codex. I caught a post on a blog about caching issues when using a third-party cache plugin.
In plain-vanilla WordPress just calling update_field() after wp_insert_post works perfectly. However, we are using WP Super Cache and I’ve seen update_field() fail because the post ID doesn’t exist in the database due to the data being cached in memory.
I don’t have the article on my work computer, I was working on my laptop over the weekend and it’s there.
In any case, WP Super Cache has a filter for database reads and writes and hooking that will flush the memory cache.
Code works fine now.
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!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 29, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.