3

I’m trying to set up local json sync with ACF on a multisite installation. It worked with the default acf-json folder in the child theme, but I’d like to save and load everything from the parent theme. I managed to make it work when it comes to saving (custom fields will get saved to the parent theme folder from all subsites). However, the filter for loading (acf/settings/load_json) doesn’t seem to trigger. Even when I just try to output some strings in the error log.

I’m not sure what I’m doing wrong since I basically just copy pasted the documentation’s code and only changed the path, but the fields won’t sync.

Any help would be appreciated! Thank you 🙂

Here’s what I put in functions.php:

// changes saving location for custom fields
add_filter('acf/settings/save_json', 'my_acf_json_save_point');
function my_acf_json_save_point($path) {
    // update path
    $path = get_template_directory() . '/custom-fields';
    
    // return
    return $path;
}

// changes loading location for custom fields
add_filter('acf/settings/load_json', 'my_acf_json_load_point');
function my_acf_json_load_point( $paths ) {
    error_log('hey!');
    
    // remove original path (optional)
    unset($paths[0]);
    
    // append path
    $paths[] = get_template_directory() . '/custom-fields';
    
    // return
    return $paths;
}
1
  • Sorry, but 3rd party plugin questions are off topic here. You should ask their support or in more general WP groups instead.
    – kero
    Commented Oct 13, 2021 at 8:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.