Recently I came across an amazing plugin named Advanced Custom Fields. This thing allows me to rapidly develop themes with clean, easy to use forms for custom fields. Those custom fields become the main content of front end layouts, much like my current About page.
This plugin has the ability to have a JSON file that has your field structure in it, and if you update that file, it will ask you if you want to sync those changes. Well, since I am going to hide the plugin, and I want to just push updates to my clients, I needed a way to automatically sync the updates.
I opened up the code for the plugin to see how the sync worked, took some of the code, and wrote my own function to perform the sync. Enter the gist of it:
I’ve tested it with one and two updated JSON files at the same time without any issues. You just need to be sure you understand what you’re doing with the Synchronized JSON ability of ACF.