Support

Account

Forum Replies Created

  • @hube2 The current issue I see is that the acf/settings/save_json filter doesn’t override the new behavior in 5.9.0. It is ignored now so if you’re not using it you should be fine. If you are using it there is no effect from it anymore. The documentation either needs to be updated to reflect that it no longer has any effect (and should be removed) or the logic should be changed so it is a higher precedence than the new 5.9.0 functionality.

  • If I’m understanding correctly, I’ve run into the same issue with the old way of saving local json files changing. I used the old save behavior (pre-5.9.0) to manage json files in my development flow. In the functions.php file I’d put the following:

    
    function webpack_acf_json_save_point( $orig_path ) {
      $path = $orig_path; // ACF PATH SETTING
      return $path;
    }
    add_filter('acf/settings/save_json', 'webpack_acf_json_save_point');
    

    The webpack build process would replace $orig_path with the src folder I keep the /acf-json folder in my project.

    So ACF loads up the json files from the regular theme location (such as wordpress-installation/wp-content/themes/my-theme/acf-json) and when I save changes to ACF fields, ACF would write them to the path my build process specified in the filter (my-project/src/acf-json) and webpack would copy them back into the theme folder during development so the dev site worked fine.

    With the new feature that is explained on the blog announcement as: “Now, no matter where the .json file was loaded from, it will be updated when making changes to a Field Group.” means that it no longer saves where I specified in the filter above. It essentially ignores that filter from what I can tell. I would consider that a bug because the filter is there to say, “I know what the default functionality is (new or old), but this is where I want you to write the json files.”

    What I ended up doing is adding in a second filter:

    
    function webpack_acf_json_load_points( $orig_paths ) {
      $paths = $orig_paths; // ACF LOAD PATH SETTING
      return $paths;
    }
    add_filter('acf/settings/load_json', 'webpack_acf_json_load_points');
    

    That is also managed by webpack in a similar way to the other filter and it works with the new feature (I haven’t tested it but I assume I can delete my original filter on save_json and with the new functionality it would save it back to that folder).

    I realize now that I probably should have done it originally with both of the filters in place, but didn’t see that until the new functionality came out.

Viewing 2 posts - 1 through 2 (of 2 total)