acf show all fields in group ACF Show all Fields in Group acf pro banner

ACF Show all Fields in Group

The ACF (Advanced Custom Fields Pro) Elliot is one of the best methods for quickly adding Custom Fields to your WordPress Posts / Custom Posts. A nice feature of the plugin is the intuitive method of grouping together fields in ‘Field Groups’. Oddly the ACF documentation doesn’t fully cover how to output all fields in a particular group. Here’s our approach:-

Output all Fields in ACF Field Group

// enter your Field ID in 123
$fields = acf_get_fields(123);

if( $fields )
foreach( $fields as $field )
$value = get_field( $field['name'] );

if(!empty($value)) {
echo '<dl>';
echo '<dt>' . $field['label'] . '</dt>';
echo '<dd>' .$value . '</dd>';
echo '</dl>';

The ACF field group is visible in the URL when you edit the Field Group >
i.e. /wp-admin/post.php?post=123&action=edit

Why not make this into a Shortcode?

For handy including into your WordPress front-end you can easily make the above into a WordPress shortcode by wrapping it with the following PHP in your Child Theme functions.php file:-

// ACF Group Shortcode 
function shortcode_acfgroup( $atts ){ 
// start 
// add the above php here 
// end 
add_shortcode( 'acfgroup', 'shortcode_acfgroup' );

To add in your ACF Group Fields simply then add the shortcode [acfgroup]

About the Author
acf show all fields in group ACF Show all Fields in Group 0da77002febbfe28d15144a57bbcc2c9 s 180 d mm r g


A highly experienced Web Designer / Web Developer (Webflow, WordPress, Weebly & Custom), Front-end / Back-end Developer & New Media Specialist, with extensive knowledge of a wide spectrum of technologies in the Development and Creative Industries, built up over a number of years.