@infinimbal I’ve added a select box for paths to your code. Filled with load_json points.
It works the same. Two bugs I’ve found so far, in both our versions:
1. If you edit a FG and change the JSON Save Path the FG does get saved there, but the one in the old path remains. We need to write or use a function that deletes the old.
2. The path selected/entered is also saved in the DB and the JSON under the json_save_path key. We’re hooking into
acf/update_field_group which happens at line 551 in
acf-field-group-functions.php. If you scroll up a bit there we have
$save being built with
$_field_group in it, and then being saved before our code runs. So even if we remove it before returning
$field_group it won’t help. We could instead use the hook
acf/validate_field_group, which runs much earlier, but I haven’t tested this yet.
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!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 29, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.