If you are using the ACF plugin in your Multisite Website. ACF has a feature where you can add, delete or update fields on the Main theme and automatically reflect on subsites.

You can configure this by following this steps:

  1. Add a folder right after the Main Theme. You can name it as acf-json folder . (any name is fine)
  2. Enable the feature by adding the code below to your function.php
/*-------------------------------
# Multisite Local JSON
--------------------------------*/

add_filter('acf/settings/save_json', function() {
    return get_template_directory() . '/acf-json';
});

add_filter('acf/settings/load_json', function($paths) {
    $paths = array(get_template_directory() . '/acf-json');

    if(is_child_theme()):
        $paths[] = get_stylesheet_directory() . '/acf-json';
    endif;

    return $paths;
});

The code above means:

  • acf/settings/save_json – all saved fields will store on created folder.
  • acf/settings/load_json – load the saved fields on created folder.
ADVERTISEMENT

Leave a Comment

Subscribe to the Newsletter

Subscribe to get my latest content by email. I won't send you spam. Unsubscribe at any time.

Newsletter
ADVERTISEMENT