Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mishterk/d3b8ced5dad3f8b0f57f5b2a2173bf05 to your computer and use it in GitHub Desktop.
<?php
add_action( 'admin_post_acf_sync', function () {
$field_groups = acf_get_field_groups();
// Apply our callback to all field groups
array_map( function ( $field_group ) {
// Load up the fields on the field group.
$field_group['fields'] = acf_get_fields( $field_group );
// Write the local JSON file for the field group.
acf_write_json_field_group( $field_group );
}, $field_groups );
echo 'done!';
} );
<?php
$field_groups = acf_get_field_groups();
// Apply our callback to all field groups
array_map( function ( $field_group ) {
// Load up the fields on the field group.
$field_group['fields'] = acf_get_fields( $field_group );
// Write the local JSON file for the field group.
acf_write_json_field_group( $field_group );
}, $field_groups );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment