Home › Forums › ACF PRO › Field always returns NULL › Reply To: Field always returns NULL
Hi @pero
I’m afraid acf_get_fields() will always return an empty value. Instead, please use the get_field() function to get the value like this:
$groups = acf_get_field_groups(array('post_id' => get_the_ID()));
foreach( $groups as $group_key => $group ) {
$fields = acf_get_fields($group);
if($fields ) {
foreach( $fields as $field_name => $field ){
echo get_field($field['name']);
}
}
}
Hope this helps!
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.