Schema Versioning — Rollback Field Group Changes
Field Forge saves a revision of a field group each time you save a change to it, with the author and the time, and keeps the 50 newest. The History window lists the 20 newest, and Restore asks for a second click to confirm.
Why field group versioning matters
WordPress has revision history for posts (since 2.6). Every post edit is saved as a revision, and editors can revert to any previous version.
Without a history, a saved change to a field group replaces the earlier state. Field Forge keeps the earlier states, so a change can be restored.
Field Forge fixes this with a revisions table: wp_fieldforge_revisions. Every field group save creates a new revision. Field Forge keeps the 50 newest revisions. The History window lists the 20 newest, and Restore asks for a second click to confirm.
How it works
Every save creates a revision
When you save a field group, the plugin:
- Takes the current state of the field group (title, fields, location rules, menu order)
- Calculates a content hash (MD5) of that state
- Checks if the latest revision has the same hash (so a save without changes makes no revision)
- If different, adds a row to the
fieldforge_revisionstable (with your database prefix) with the group, a version number that counts up per group, the title, the fields, the location rules, the menu order, the hash, the user who saved it and the time
This happens on each save that changes the group: a save with the same hash as the newest revision makes none.
Viewing revision history
In the editor of a field group, click the History button. A window opens with the list of revisions. Each row shows the version number (v12), the number of fields, the author (or System when the save did not come from a logged in user) and the date.
There is no side by side comparison of two revisions in the admin.
Restoring a revision
Click Restore on a revision and confirm with a second click (Confirm restore?). Field Forge:
- Saves the current state of the field group as a revision first (so the restore itself can be undone)
- Overwrites the title, fields, location rules and menu order of the field group with the ones of the revision
If you restored the wrong revision, open the History list and restore the one you wanted. Only administrators (the manage_options capability) can list or restore revisions.
Automatic pruning
The revisions table grows over time, so Field Forge keeps the newest 50 revisions of each field group:
- Max 50 revisions per field group. The limit is fixed: there is no setting or filter for it
- Oldest revisions deleted first when the cap is reached
- Pruning runs on save, right after a new revision is added
Use cases where versioning saves the day
Client site accident
An editor or admin accidentally deletes a field from a field group. Restore the previous revision of the group to bring the field definition back. Values that were saved for the field are separate rows and stay in the database.
Bad deployment
You edited a field group on staging and deployed to production, but the change introduces a bug. Restore the previous revision, investigate the bug, re-deploy with the fix.
Collaboration conflicts
Two team members edit the same field group. Every save is a revision, so each version can be restored later.
Who changed it, and when
Each revision records the user who saved it and the time. That gives you a simple trail for the latest 50 saves of each field group.
Combining with Local JSON Sync
Schema versioning and Local JSON Sync work together:
- Local JSON gives you file-based field groups that travel with git
- Schema versioning gives you database-level history, restored from the History window with a second click to confirm
Git history covers the “what did we deploy” question. Schema versioning covers the “what happened since we deployed” question. Together they cover both worlds.
Ready for field group version control?
Schema versioning is in the free plugin and in every plan.