Support

Account

Home Forums Add-ons Repeater Field Repeater's Big Problem :((( , Please read it!! – thanks a lot ^^ Reply To: Repeater's Big Problem :((( , Please read it!! – thanks a lot ^^

  • I don’t think they are saying anything different. What is important is keeping the meta key in the database unique for any WP object. For example, for a post, term, user, options.

    This is how meta keys are determined and all the entries you will find in the DB

    Top Level Field (field that is not a sub field of another fields) All top level fields stored for the same type of WP object must be unique: "{$field_name}";

    Sub fields of a repeater, this includes repeaters and flexible content: "{$repeater_field_name}" AND "{$repeater_field_name}_{$row_index}_{$sub_field_name}"

    Group Fields, group fields are a special kind of repeater that always has exactly 1 row: "{$group_field_name}" AND "{$group_field_name}_{$sub_field_name}"

    Clone Fields: Clone fields are more complicated because how they are stored is determined by the display setting. When using “Seamless Display” Cloned Fields work like top level fields or like sub fields of the type of parent field they are cloned into. When using “Group” display fields in them work like sub fields of Group Fields.

    Everything can be nested, for example if you have a field that is in a repeater and the repeater is in a group field and that group field is a sub field of a flex field then the field key of the final field would be

    
    "{$flex_field_name}_{$row_index}_{$group_field_name}_{$repeater_field_name}_{$row_index}_{$sub_field_name}"
    

    As you can see by the above, with a unique top level field name there should never be a conflict and as long as the top level field name is not duplicated on the current WP Object, there should not be a conflict.

    With top level repeater fields of different names and/or fields stored for multiple things like one field on a term and one field on a post there are 2 things that can cause them to go wrong when using them in the same template.

    1) Using the second repeater before you are done looping over the first repeater. This will cause ACF to loose track of the first repeater when the second loop begins.

    2) Not specifying the correct $post_id when starting the loop over a repeater.

    Because you are using elementor I cannot tell you if either of these 2 things are happening. But what I can tell you is that you will have an extremely difficult time displaying fields for a post on template designed for a term and you will have a difficult time displaying fields for a term on a template designed for a post.

    On a term template (archive) the correct $post_id must be supplied for both the post and the term. ACF should be able to determine the Post ID of the post if you are in a loop over the posts. The $post_id of the term must always be specified.

    On a post template (single post) the $post_id for the term ACF will be able to determine the post ID of the current post. The $post_id of the term must always be specified.