Support

Account

Home › Forums › Backend Issues (wp-admin) › JSON REST API and ACF? › Reply To: JSON REST API and ACF?

  • Figured it out. The correct hook is json_prepare_post.

    <?
    add_filter('json_prepare_post', 'json_api_encode_acf');
    
    function json_api_encode_acf($post) {
        
        $acf = get_fields($post['ID']);
        
        if (isset($post)) {
          $post['acf'] = $acf;
        }
    
        return $post;
    
    }
    ?>