'ACF - How can I get all the fields of a field group

I have multiple fields on a field group called Membership Level Feature and which post id is 5112. Now, I want to get all the fields of this post id. I am using:

echo '<pre>';
print_r( get_fields(5112 )  );
echo '</pre>';

But getting empty :(

Please check this image:

enter image description here



Solution 1:[1]

Try this:

if (function_exists('acf_get_field_groups')) {
    $acf_field_group = acf_get_field_group(5112);
    $acf_fields = acf_get_fields(5112);
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hillel