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
Solved!!!
I dug into the ACF core for a while and after a ton of trial and error, I found a super simple way to do this.
I created a custom endpoint that does the following:
// Get new post's ID
$post_id = $request['id'];
// Get new post's meta fields
$meta_fields = get_post_meta($post_id);
// Save the meta fields to the post
acf_save_post($post_id, $meta_fields);
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.