Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Print all ACF fields in a group with labels and values
<?php
$fields = array();
$field_group = get_page_by_title( 'GROUP TITLE HERE', OBJECT, 'acf-field-group' );
if ( is_object( $field_group ) ) {
$acf_fields = acf_get_fields_by_id( $field_group->ID );
$fields = wp_list_pluck( $acf_fields, 'label', 'name' );
}
foreach ( $fields as $field_name => $field_label ) {
printf( '<b>%s:</b> %s', $field_label, get_field( $field_name ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.