Support

Account

Home Forums General Issues Field inside Clone and default field data should not sync when slug is the same

Solved

Field inside Clone and default field data should not sync when slug is the same

  • How to setup
    Create a Field Group with a simple Link field with the slug “link”.
    Create another Field Group with a Flexible Content field, add a layout.
    Inside the layout, add a Clone field with all the fields from the first Field Group.
    Set the Clone to act like a group.
    Add a simple Link field to your layout with the slug “link”.

    Both fields will now always have the same data, even though they shouldn’t, since one is in a group and the other isn’t. I should normally be able to have the same slug, so I can get the data of both fields like this:

    get_sub_field('name_of_clone')['link'];
    get_sub_field('link');
  • You must prefix the field names. Without the prefix your field in the clone and your field not from the clone will have the same field name.

  • Of course, except if I were to put the Link field inside a standard Group field, now they could both have the same slug. And I could retrieve the data of both fields like so:

    get_sub_field('name_of_clone')['link'];
    get_sub_field('link');

    So logically, I should be able to do the same inside a clone that is set to act like a group, no?

  • The clone field does not work like a group field when changing the display, it only looks like a group field when that option is selected. So no, clone fields do not work like group fields.

    If you want them to work like a group field then you would actually need to create a group field and clone your fields into that group and set it to seamless.

  • I see, seems a bit counterintuitive to me, I feel like they should both act the same, but adding a group and changing it to seamless does the trick, thanks!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.