Support

Account

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.

    https://gist.github.com/toscani/635a0ef618fd199d069550f124fe68e6

    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.