Shibbir
Shibbir

Reputation: 2041

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

Upvotes: 7

Views: 13261

Answers (1)

Hillel
Hillel

Reputation: 929

Try this:

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

Upvotes: 8

Related Questions