Support

Account

Home Forums ACF PRO Double nested clone fields in WordPress Rest API responses

Unread

Double nested clone fields in WordPress Rest API responses

  • I created a field group called “Clones”.

    I have a separate flexible template field group where I’ve been cloning field groups from the “Clones” field group with display set to “seamless”.

    I’m using ACF json to version control field groups and track changes to these field groups.

    My site is headless so I rely on the WP Rest API to send data to my front end app in Nextjs.

    The issue that I’ve noticed is that, in some cases, the response comes back nested twice…


    "seo": {
    "seo": {
    "title_tag": "Looks like you took a wrong turn!",
    "meta_description": "Page not found"
    }
    },
    "hero_section": {
    "hero_section": {
    "heading": "Looks like you took a wrong turn!",
    "image": false,
    "description": "",
    "links": false
    }
    },

    I haven’t seen this issue in the forums but I think that I might remove all cloned fields since I can’t reliably prevent malformed data from appearing. My guess is that its an issue with “display: seamless” where the fields aren’t always replaced.

    It might have something to do with naming. In the case above the field group is “seo” and the cloned group is also called “seo.” Same with “hero section”, both the field group and cloned group have the same name. If this is the reason for the bug there should be some way to validate the names so they don’t match.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.