Home › Forums › General Issues › Correct Way to Create a New ACF Post › Reply To: Correct Way to Create a New ACF Post
The problem with using update_field() is that according to the WordPress Codex, calls to update post meta after wp_insert_post() may fail if the post is still in memory (cached).
I did try that and it worked most of the time, but occasionally the post meta was not updated.
An “acf_insert_post()” function would be fantastic. Or a function that fixes the meta_input() array by adding the appropriate ACF info.
It looks like I might be able to construct something using the “get_sub_field_object()” function and passing the field name.
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.