Home Forums General Issues ACF Fields now showing in "rest_do_request" result


ACF Fields now showing in "rest_do_request" result

  • Hi. I have some ACF fields defined on both a custom post type and custom taxonomy. All works well (GET and POST) when accessing the REST API “traditionally”, but when we use the internal REST functionality using the “rest_do_request()” function in our template, the result does not include the ACF fields. (Switching the “ACF to REST API” plugin does work, but causes other issues.) Any help would be greatly appreciated…

  • Encountered the same issue, submitted a fix here:

    There’s a temporary workaround you can use though. Run this before each call to rest_do_request():

    // set URL as "rest_route" in global WP query_vars, e.g. "/wp/v2/posts/919"
    $GLOBALS['wp']->query_vars['rest_route'] = $url;
    // re-initialize the ACF Rest Api class
    // now, call rest_do_request
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.