Support

Account

Home Forums General Issues How to get group from parent post?

Unread

How to get group from parent post?

  • I’ve run into an issue with grabbing a group field from the parent post, using the same method that works for grabbing a repeater field from the parent post.

    First off, I have a field group containing a group field named impact_data. Within this group I have four sub fields that I would like to display.

    No problem displaying the group sub fields when they exist on the current post, but attempting to display them from the parent post doesn’t display anything.

    This is the method that works for me when grabbing repeater fields from the post’s parent:

    // Check for local sponsor logos
    $local_rows = get_field('sponsor_logos');
    // Check for parent sponsor logos
    $parent_rows = get_field('sponsor_logos', $post->post_parent );

    Then I do a conditional to check if $local_rows exist and display them, else if $parent_rows exist display them.

    I’m trying to do the same thing with a group field, but it doesn’t seem to be working. Any ideas on how to format this to get it to work for displaying group field data from the parent post?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.