Home Forums ACF PRO Group Field contains Group Fields


Group Field contains Group Fields

  • Hi,

    Is it possible to have group fields in a group field? I have a 3 boxed Layout. One Box has a Headline, a text and a link. So – for the Author it would be nice to have this input in the backend. It does not have to be a repeater – there will be always just 3 Boxes with “flex”.

    Thanks for your help in advance!


  • If the question is simply, can you put group fields in a group field, then then answer is yes.

  • Yes, I did it once with a repeater field. Can you provide a simple code example how to do it?

    Would be nice.

    Thanks for your reply!

  • I honestly don’t know, what code do you mean? The code to get the values? I’ve never done this. But there is an example of getting the values of a group field on this site. A group field works just like a repeater field, mostly.

  • Ok, I´m Sorry that I didn´t post some code examples.

    Here is the Code i have which is working fine:

    <div class="zeitschrift-box-wrapper">
                <?php if( have_rows('zeitschrift_box') ): while( have_rows('zeitschrift_box') ): the_row(); ?>
                <img src="<?php echo $upload_dir['baseurl']; ?>/2018/03/second-bg.svg" alt="B2B Publishing">
                <?php the_sub_field('text'); ?>
                <a href="<?php the_sub_field('link'); ?>"><?php the_sub_field('link_text'); ?></a>
                <?php endwhile; ?>
                <?php endif; ?>

    What if I have three of these blocks in a “parent” Group?

    Do you know what I mean?


  • Sorry for not getting back to you sooner.

    A nested Group field would work the same way as a nested repeater field.

    if (have_rows('parent_group')) {
      while (have_rows('parent_group')) {
        if (have_rows('child_group')) {
          while (have_rows('child_group')) {
            // etc

    or you can do something like

    $values = get_field('parent_group');

    and this will return the whole nested array that you can work with

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

The topic ‘Group Field contains Group Fields’ is closed to new replies.