Home › Forums › General Issues › Get_fields() returns false until I update the post › Reply To: Get_fields() returns false until I update the post
Thank you John.
I found a helper function called acf_maybe_get_field() – my plan is to use this function to get the field keys of each field.
I will use wp_insert_post to create the post.
Then after successful post creation, I will use update_field with the field key to update the post field values. This should save the data into wordpress as if i had manually added it in the wp-admin.
From what i have found acf_maybe_get_field() is the only function that can get me the field keys even before the values exist.
Does this sound like a solid plan?
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.