Home Forums ACF PRO Multiple Save Locations for JSON? Reply To: Multiple Save Locations for JSON?

  • @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 can instead use the hook acf/validate_field_group, which runs much earlier, but I haven’t tested this yet, or another hook.