Local JSON saves field group definitions as .json files in your theme, enabling version control and cross-environment deployment. Requires PRO license.
This is Field Forge’s own Local JSON format and uses fieldforge-json/ by default. The ACF migration tool also understands ACF’s Local JSON source files from acf-json/group_*.json, so a site can import ACF field groups even when the acf-field-group and acf-field database posts are absent.
Setup
- Enable Local JSON in Field Forge > Settings.
- Create the directory:
your-theme/fieldforge-json/ - Field groups auto-save to this directory when edited.
bash
your-theme/
fieldforge-json/
group_1_product-fields.json
group_2_hero-section.json
.htaccess # Auto-created: "Deny from all"
index.php # Auto-created: silenceBidirectional Sync
Field Forge detects JSON changes on admin load:
- JSON to DB: New or modified JSON files are imported into the database.
- DB to JSON: Database changes are exported to JSON files.
Deployment Workflow
text
Development Staging Production
----------- ------- ----------
1. Edit field 3. git pull 5. git pull
groups in UI 4. Visit admin -> 6. Visit admin ->
2. git commit auto-sync auto-sync
fieldforge-json/ JSON -> DB JSON -> DBProgrammatic Sync
php
// Force export all groups to JSON
$local_json = FIELDFORGE_Local_JSON::instance();
$count = $local_json->save_all();
// Check for differences
$diff = $local_json->get_diff();
// Returns: ['new_in_json' => [...], 'new_in_db' => [...], 'modified' => [...], 'in_sync' => [1, 3]]
// Run sync (JSON wins)
$result = $local_json->sync( 'json_to_db' );
// Run sync (DB wins)
$result = $local_json->sync( 'db_to_json' );—