Support

Account

Forum Replies Created

  • SIR JOHN HUEBNER

    Please help me answer this conundrum about ACF Field. I have searched in many places but there is no answer, I can only hope in this place.

    Question: Should I name the SubField of the Repeater Field a simple separate name like: Title, Image… or should I include the parent field in it like: Parent_Subfield???

    Case 1: If I name Subfield as a simple name that does not include parent fields like Title, Image… but they will overlap and be the same as Subfield names in other groups of fields with the same subfield as Title, Image. … I’m afraid this will cause an error because ACF recommends that field names should be unique.

    Scenario 2: If I set a Subfield with a name that includes the parent field name along with a child field like parent_subfield – then I should be able to create unique field names and not confuse subFields in other field groups. But the problem here is that if used together with the parent field name in the child field, it will make the field name sometimes very long and confusing (especially with many layers of field groups and many repeating fields with subfields in the field). my project)
    Example: Field group name is Movie – group field is Video – repeat field is Hero Banner – Subfield is will be Image
    Then the name of the Image field will be movie_movievideo_movievideoherobanner_image

    It is very long and very confusing!

    I hope I have described it clearly enough for you to understand this dilemma
    So please give me the best solution for this?
    Once again I would like to thank you very much ^^

  • I really appreciate your detailed answer for me.

    People who had the same question certainly had the correct answer for them.
    But I’m a fool in faraway Korea, please forgive me for that ^^!

    So I want to ask you one last question, and I won’t bother you again. So that I can be sure that I understand correctly.

    {According to your explanation: I can understand that I can still use the same Subfield Names – in Groups and Repeating Senior Fields provided these Parent Fields are named Unique. best???}

    And is this allowed and legal in ACF?

    The display errors you’re warning about, are only encountered when using with Elementor right? (Actually I’m also getting an error about not showing the same subfield names on the same page on Elementor, but when selecting the correct parent field, then selecting the child field name, even though it’s in the other high level, it still shows properly: Specifically 1 Subfield named Image located in 3 Repeated fields A, B and C, but when I search, it shows only 1 subfield named Image in the field high-level group C. But when selecting the Parent Group Field as A, then selecting the Image link in the group C field, it still returns the correct result as the image of the Image subfield in group A)

    And so, in essence, using the same Subfield Names in the Group and Repeat top-level fields, is correct and correct with the ACF stipulation? the errors shown above are encountered only when combined with Elementor?

    With my many long and stupid questions. You can simply answer YES or NO! ^^
    Although I am still confused and would like your advice should I decide to use the same and simple Subfield Names for many other subfields or should I prefix the subfields so that they are unique and avoid the possible error as you warned.

    Because having to prefix the child field names of all groups and repeating parent fields would become very complicated for me. (Since my project is very large and has many SCHOOL GROUPS), even adding prefixes to subfields will still result in the same name as other subfields in other Field Groups. And if it is required to include more layers of prefixes like: prefix1_prefix2_prefix3_subfields to create uniqueness for subfields, that would be a real nightmare for me 🙁 – because it would get very long and feels like it’s the wrong way:
    For example, 1 repeating parent field named Homepage_Gallery and 1 subfield Homepage_Gallery_Image (And when I search for the Image subfield on Elementor it will be the string Homepage_Gallery_Homepage_Gallery_Image – it gets very complicated and elusive, though in the reality I’ve encountered will have many layers of lower-level subfields and their string visualizations to be complicated and nightmarish…)

    I may be fired if I don’t solve this most correct subfield name selection, please help me 🙁 🙁 🙁

    Looking forward to receiving your comment or reply YES or NO.
    Thank you for listening and wish you all the best, kind person!!

  • I got this answer also from ACF support itself. But it seems to contradict the expert John Huebner’s answer above?

    So the final answer to this is: it is possible to name the child fields the same, as long as it is unique in a parent field.
    But then it should not be named the same subfield in any case on the same page or in different groups. Because they can cause errors????

    So which is the correct one? Even the ACF rep has me baffled 🙁

    Because the field naming is simple and the same as Tile, Image – will be very different from prefixing each subfield.
    I just want to know what is actually correct and does not lead to future errors or crashes. If naming the same subfield on a page or in a different group would result in an error, then why does ACF allow that simple and identical naming?

    Chris Mucheke (WP Engine Support)

    Hi there,

    Thanks for reaching out to us, I trust you are keeping safe!

    When it comes to naming ACF subfields for repeaters, it is generally recommended to use simple and concise names that describe the content of the subfield. You can name the subfields as Title, Image, etc. without including the parent field name, as long as these names are unique within the repeater field.

    However, if you have multiple repeater fields with the same subfield names on the same page, it can lead to data corruption and accessibility issues. To avoid this, it is a good practice to prefix the subfield name with the repeater field name, for example, if you have two repeater fields with a subfield named “Title”, you can name them as “Repeater1_Title” and “Repeater2_Title”.

    In addition, it is recommended to avoid using the same subfield names across different groups of fields, as it can also lead to data corruption and field inaccessibility. Instead, try to use unique names that describe the content of the subfield.

    To summarize, when naming ACF subfields for repeaters, use simple and concise names that describe the content of the subfield. If you have multiple repeater fields with the same subfield names on the same page, prefix the subfield name with the repeater field name to avoid data corruption and accessibility issues. And, avoid using the same subfield names across different groups of fields to prevent data corruption and field inaccessibility.

    Hope that all helps, please let me know if anything needs clarification.

    Kind Regards,

    Chris

  • Thank you very much Sir John Huebner, I feel like a pain is released. I want to give you my sincerest thanks ^^ <3<3 You are so lovely

  • Hello, Mr. John Huebner. Thank you sir for your prompt reply and very valuable to me at this time. I think I understood 80% of the answer.

    But please understand that, I am a Korean, English is not the main language, and I am afraid that I am misinterpreting, or not fully understanding, your explanation correctly.
    So I would like to give a specific example below. And hope you can answer me, is it right or wrong:

    1.I create 2 Field Groups: (A Field Group) and (B Field Group)

    2. Then I point (A Field Group) to CPT (custom post type) which is MOVIE
    and point (B Field Group) to CPT as MUSIC

    3. Finally I create 2 Single Post in Elementor with same name MOVIE and MUSIC

    :- At (A Field Group) I created a Repeater Field with the name “Banner”
    Then I create the Sub-Fields of “Banner” as: Title and Image
    :- And at (B Field Group) I created a Repeater Field with the name “Catalog”
    Then I create the Sub-Fields of “Catalog” as: “Title” and “Image”

    **** Thus (2 Repeater Field: Banner & Catalog) of (2 Field Group: A & B) All have Sub Fields named: “Title” and “Image”

    :— According to Mr. John Huebner’s explanation, is this the case allowed???? When the subfields are the same, but the names of the Repeater Field parents are different???

    But I get very serious errors in Elementor when using a Plugin to call Repeater Fields Dynamic.ooo (Because Elementor doesn’t support Repeater Field yet)

    The error is when the Sub Fields have the same name between 2 Field Groups (or 2 parent fields are Repeater Field: Like Banner & Catalog).

    :— Then the errors encountered are: 2 Repeater Field Banner & Catalog, will not be able to fully display both, but one side will disappear and cannot be found and called out.

    Can you help me answer. This error belongs to Dynamic.ooo – ACF or Elementor??? They make me very tired to see where I am going wrong, and having to name the Sub Field the same, makes the situation worse.
    I’d love to keep the name short and not include the parent’s name in the sub field. But when using a common name like Title for Repeater Fields in different Field Groups, they often can’t be found or the error doesn’t show up in Elementor’s Dynamic.ooo.

    It took me a whole month to figure this out and the best solution. But the experts they couldn’t answer either.

    Please help me Sir John Huebner. I will be very grateful to you ^^.
    Thank you for everything, looking forward to your best explanation. Wishing you all the happiness and luck in life

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