Home › Forums › General Issues › Headless WordPress: ACF fields return empty once a post is created with WP-API › Reply To: Headless WordPress: ACF fields return empty once a post is created with WP-API
Had the same issue, but for creating a new post using automated functions. So created this function that gets all the fields with their defaults values and updates the post metadata.
https://gist.github.com/dfinnema/da4c6afdff2eaa4274f3709585d80c8e
Make sure you run this only after creating the new post and before adding data to it.
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.