Support

Account

Home Forums ACF PRO Get a lists of fields groups by page ?

Solving

Get a lists of fields groups by page ?

  • Hi, i was wondering if there’s a way to return all the fields groups available for a given page.

    get_field_objects() and get_field_object return fields information rather than fields group.

    I’m asking, because i’m trying to build à page template that includes templates parts based on the the fields group available for the page. These templates parts should then have the codes to process the field group content.

    Any idea ?

    Thank you

  • From ACF posts.php and api-field-groups.php, this should get you started:

    $posts = get_posts(array(
      'post_type' => 'acf-field-group',
      'posts_per_page' => -1,
      'orderby' => 'menu_order title',
      'order' => 'asc',
      'suppress_filters' => false, // allow WPML to modify the query
      'post_status' => 'publish',
      'update_post_meta_cache' => false
    ));
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Get a lists of fields groups by page ?’ is closed to new replies.