Home › Forums › Add-ons › Repeater Field › Get all Fields & Sub Fields of a POST ( Repeater) › Reply To: Get all Fields & Sub Fields of a POST ( Repeater)
If you want to return all the fields of a field group you can use
$fields = acf_get_fields($group_key);
if you want to get all the field groups for a post
$groups = acf_get_field_groups(array('post_id' => $post_id));
putting them together
$groups = acf_get_field_groups(array('post_id' => $post_id));
if ($groups) {
foreach ($groups as $index => $group) {
$groups[$index]['fields'] = acf_get_fields($group['key']);
}
}
echo '<pre>'; print_r($groups); echo '<pre>';
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.