Local JSON saves field group definitions as .json files in the uploads folder, enabling version control and cross-environment deployment. Available in the free plugin: FIELDFORGE_Local_JSON::is_enabled() checks the fieldforge_settings['local_json'] setting only, with no license check.
This is Field Forge’s own Local JSON format and uses wp-content/uploads/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.
- Save a field group: Field Forge creates
wp-content/uploads/fieldforge-json/by itself, with a.htaccessthat denies direct access and anindex.php. - From then on a field group is written to this folder when it is saved, and its file is deleted when the group is deleted.
Field Forge writes only here. To keep the files in a theme or plugin repository, add that folder to the places it reads with the fieldforge/local_json/load_paths filter.
wp-content/uploads/
fieldforge-json/
group_1_product-fields.json
group_2_hero-section.json
.htaccess # Auto-created: "Deny from all"
index.php # Auto-created: silenceBidirectional Sync
On admin load, Field Forge checks the JSON files against the database (at most once every five minutes) and shows a notice when they differ. Nothing is imported by itself:
- JSON to DB: new or modified JSON files are imported into the database when you click Sync JSON → DB (the file wins).
- DB to JSON: a field group is written to its JSON file whenever it is saved, and Sync DB → JSON writes all of them.
Deployment Workflow
Development Staging Production
----------- ------- ----------
1. Edit field 3. git pull 5. git pull
groups in UI 4. Visit admin, 6. Visit admin,
2. git commit click Sync click Sync
fieldforge-json/ JSON -> DB JSON -> DBProgrammatic Sync
// 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' );—