Skip to content

Instantly share code, notes, and snippets.

@daronspence
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daronspence/4ec625d1e371543dfa93 to your computer and use it in GitHub Desktop.
Save daronspence/4ec625d1e371543dfa93 to your computer and use it in GitHub Desktop.
ACF Group Fields
<?php
/**
* acf_group_fields
*
* This function return an array of all the field names within a field group.
*
* @type function
* @date 24/9/14
* @since 5.0.8
*
* @param $id (int) The post_id of the field group
* @return $fields (array) Field names from group
*/
function acf_group_fields( $id ){
$group = acf_get_fields( acf_get_field_group( $id ) );
foreach( array_keys( $group ) as $i ) {
$group_fields[] = acf_extract_var($group, $i);
}
foreach ($group_fields as $field){
$fields[] = $field['key'];
}
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment