Last active
August 29, 2015 14:06
-
-
Save daronspence/4ec625d1e371543dfa93 to your computer and use it in GitHub Desktop.
ACF Group Fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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