We’re using the JSON files for local > staging > prod deployments with ACF Pro.
I see you need a modified date to make the JSON files sync, which all makes sense and works for us. We have each shared ACF field as a separate JSON file which can be synced.
My question was just in terms of workflow.
At the moment our intended process is:
1. Delete the JSON file in repo
2. Make changes to structure in local
3. Export JSON File
4. Manually remove square brackets surrounding JSON (needs to these removed or else it wont reimport)
5. Manually add modified with current date in unix format
6. Push to git
7. In staging/prod go into ACF and sync changes
– At the end when I try and sync, it says it synced, but sync remains available as an option and not sync actually occurs. Deleting the ACF field in question let’s me bring in the ACF field successfully, but this isn’t ideal.
– Step 4: Is it possible to export files that don’t need the square brackets removed?
– Step 5: Is it possible to export with a generated modified date? It’s tedious to have to get and add this each time?
exporting/importing is different and using local JSON.
Export/Import creates an array in JSON that can hold multiple groups this is the source of the extra bracket.
Local JSON stores a single group.
I’m not sure I understand your process.
1) create an acf-json folder
2) save field groups which creates json files
3) commit changes to git repo
4) pull changes from git repo
5) upload json changes to server
6) syn field groups
However, as far as 6 goes, I only do this on my dev site. You should only sync field groups on the site where you make changes. These groups should not exist in the DB to be edited on sites where they will never be edited. Unless you plan on editing the field groups on staging/production the only place they should exist is as JSON files.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users