I have a site with several field groups set in the ‘acf-json’ folder of a custom theme I built for my employer.
A couple years have gone by and I am now realizing the error of my ways. I’d like to move that ‘acf-json’ folder to a site functionality plugin and out of the theme. If I do this, will I lose / need to reset all the custom fields that I’ve set over the past couple years?
TL;DR: What’s the best way to migrate Fields and Field Groups from a theme to a separate plugin?
if you have saved all field groups that you want with the acf-json folder existing then all changes are in this json files. I do this all the time.
1) Copy the field groups you want in the plugin to an acf-json folder in your plugin.
2) Delete the field groups from the acf admin, note that you will loose the ability to edit these field groups using the acf admin field group editor
3) Add a json load point in the plugin
No data will be lost by doing this.
If you want to edit a field group in the future you can import the group into ACF, make changes and then copy to the plugin again and delete the group.
It is also possible to edit and save json files directly to the plugin folder. I’m sure there are topics on this here but I can’t find any at the moment.