@hube2: I often used to define the fields for a site in PHP, with the old
register_field_group function. There are many sites that I built like that which I have updated to ACF5.
As I’m sure you know, the JSON save/sync features of ACF5 are much better. Ideally, ACF would read that file and output a bunch of JSON files in the appropriate place.
In the meantime, I did a quick and dirty little php file, similar to @morgan‘s suggestion. If anyone wants to use it, just paste the contents of a field group into the
$array variable, then set the
$themePath to the absolute path to your theme.
You have to do this separately for each field group, so it can be slightly laborious if you have many of them. I tried (for 5 minutes) to parse the entire file, but I couldn’t figure out the regex for extracting each array, so I did it the quick and dirty way.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We've just released ACF 5.12.3 with a security fix to prevent arbitrary file uploads to forms with ACF fields.— Advanced Custom Fields (@wp_acf) July 14, 2022
Now that we've released this update, we recommend updating your sites as soon as possible.
© 2022 Advanced Custom Fields.