The WordPress Advanced Custom Fields plugin has support for defining Field Groups via a JSON file (in addition to the traditional way of defining the Field Group in the WP Admin screen, at
/wp-admin/edit.php?post_type=acf-field-group). You can read about the ACF Local JSON feature in their documentation.
Database Vs JSON
One thing not clear to me in the documentation is what happens when you have two different definitions for a Field Group – one in the database and one in the JSON file.
JSON is Always Used
When both a database definition and a JSON definition are present, the JSON definition is always used – regardless of which one was modified most recently.
If the JSON was modified more recently than the database definition, you will have a
Sync option in the WP Admin screen, which overwrites the database definition using the information from the JSON definition.
If the database definition was modified more recently than the JSON, you will NOT have a
Database always displays on WP Admin Screen
Even when there is a JSON file present which defines the field group, if the field group also has a database definition the database definition will be displayed on the WP Admin screen where you would modify the field group. If you save (
Update) the field group through the WP Admin screen, it will overwrite the JSON file with the information from the database definition.
|Newest Definition||Sync||Used||Shown in WP Admin|
This is interesting. I had to deal with losing ACF fields getting overwritten due to the lack of the above knowledge. Thank you so much for the information!