Global theme customization multisite

Finally Solved it! If you are going to use this code make sure to change the options names to the ones that your theme uses (change “theme_mods_kadence-child” and “kadence_global_palette”).

I used get_option to get the recently saved data, then I looped through all sites and used update_option to set the new data on all subsites. Finally I used the customize_save_after action so this function activates just after the new customizer data is saved.

add_action( "customize_save_after", "update_customizer_networkwide");
function update_customizer_networkwide () {
    // Get current theme mods
    $theme_mods_kadence = get_option("theme_mods_kadence-child");
    $global_palette = get_option("kadence_global_palette");


    // loop through all sites and set new theme mods
    $sites = get_sites();
    foreach ($sites as $site) {
        switch_to_blog( $site->blog_id );

        update_option("theme_mods_kadence-child", $theme_mods_kadence);
        update_option("kadence_global_palette", $global_palette);
        
        restore_current_blog();
    }
}

Hope this helps some of you!