Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert an ACF Field Group from PHP to ACF-JSON
<?php
// Get all the local field groups and loop through them for processing.
$field_groups = acf_get_local_field_groups();
foreach ( $field_groups as $group ) {
// If the field group has fields, load them into the 'fields' key.
if ( acf_have_local_fields( $group['key'] ) ) {
$group['fields'] = acf_get_local_fields( $group['key'] );
}
// Write the group's JSON file.
acf_write_json_field_group( $group );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment