Home Forums Feature Requests Field Group


Field Group

  • I was wondering if the same way I can load custom fields I create with ACF if there was a way to load the “Field Group” name. I thought this could be a useful function and I wanted to see if anyone knows if this is possible.

  • Hi @kkokoruz

    Custom fields and field groups are saved as a post, so you can get it using WordPress’ functions. Maybe something like this:

    $field_object = get_field_object('custom_field_name');
    $field_group_id = wp_get_post_parent_id( $field_object['ID'] );
    $field_group = get_post($field_group_id);
    echo $field_group->post_title;

    I hope this helps.

  • Not sure I asked the question right. The first step in the process it to create a Field Groups Title. Then you create individual field Labels within the Field Groups.

    I’m not interested in the label names but rather the Field Groups Title. It would seem like I could take the post ID and echo the Field Groups Title. Right now in most cases my Field Groups Title is the same as what I hard could into my templates. It would be nice to pull the post id to dynamically create the title that display in the front end.


  • Hi @kkokoruz,

    I’m not so sure with your request. Could you please explain it in more detail with screenshots of the issue? That way I know which title did you want to show and where you want it.

    Thanks 🙂

  • In this example the Field Group Title is Apprenticeship On Demand and the post id is 263 (visible in the url)

    When I put the code for the ACF into a page section the title is always hard coded but I would rather make the section title dynamic to the Field Group Title.

    It would also be useful to dynamically pull the Label from the Fields within the Group. In this example the Field Labels are Description and Image.

    Is it possible to pull the Title of the Field Group and the Labels from within the Field Group?

  • Hi @kkokoruz

    Could you please tell me which ACF version did you use? I’ve just found out that the code I gave you doesn’t work on ACF free version. I’m afraid you need to get it manually from the database.

    If you use the PRO version, I believe the code does what you asked for. It will get the ID of a custom field and use it to get the object of the field group. With that object, you can get field group title.

    Regarding the label, I believe you can do it by using the get_field_object() function. This page should give you more idea about it:

    I hope this makes sense 🙂

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

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