Skip to content

How to get ACF post object field with ACF fields #109

Closed
@josephdonnelly

Description

Hey, maybe I am missing something, but I am having trouble retrieving custom post ACF data within a post object field.

I have a custom post type call Rentals where I have set up ACF fields.

I can retrieve all of the acf data by getting /wp-json/wp/v2/rentals/{id}

When I create a page with an ACF Post Object field where I select a specific rental, I don't see any of the ACF data in the response. When I get /wp-json/wp/v2/pages/{id} I get this response:

...page data
"acf": {
    "rental": {
      "ID": 191,
      "post_author": "1",
      "post_date": "2017-02-28 18:24:35",
      "post_date_gmt": "2017-02-28 18:24:35",
      "post_content": "",
      "post_title": "Rental 1",
      "post_excerpt": "",
      "post_status": "publish",
      "comment_status": "closed",
      "ping_status": "closed",
      "post_password": "",
      "post_name": "rental-1",
      "to_ping": "",
      "pinged": "",
      "post_modified": "2017-02-28 18:24:35",
      "post_modified_gmt": "2017-02-28 18:24:35",
      "post_content_filtered": "",
      "post_parent": 0,
      "guid": "http://wordpress.site.local/?post_type=rentals&p=191",
      "menu_order": 0,
      "post_type": "rentals",
      "post_mime_type": "",
      "comment_count": "0",
      "filter": "raw"
    }
  },

How do I set it up so the ACF data is included within that Post Object field?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions