Support

Account

Home Forums Backend Issues (wp-admin) How to disable auto JSON sync for some field groups? Reply To: How to disable auto JSON sync for some field groups?

  • Hi! Thank you for the quick response 🙂


    @jarvis
    I didn’t know about this! It’s interesting. I tried it and it indeed makes the field group disappear from those available for sync. Problem is that if I save the field group again (which I do all the time), the private value will disappear and they’ll start automatically syncing again. I think it would work if there was a way to check a “private” checkbox directly from the field group edit page, but I’m not sure how to do it.


    @hube2
    What I have is a multisite with a main theme, and every subsite has a child theme. Each subsite has an options page with three subpages (each of them containing one field group). I want to sync only one of those subpages, the other two need to be modified frequently to fit their site’s needs.

    In the main theme’s functions.php, I put two things: a filter to change the saving location of the JSON, and another one to change the loading location, like this:

    
    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 ) {
        // remove original path (optional)
        unset($paths[0]);
        
        // append path
        $paths[] = get_template_directory() . '/custom-fields';
        
        // return
        return $paths;
    }

    Hope that’s clear! Again, thank you for your help