Support

Account

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);