Hi there,
I have found a solution and sharing it here, it might save someone else time.
Add the following to your functions.php
add_action( 'msls_main_save', 'my_msls_main_save', 1000, 2 );
function my_msls_main_save($object_id, $class){
$forbidden_post_types = array('array of post type(child) that you want to exclude');
if (in_array( get_post_type( $object_id ),$forbidden_post_types)) {
return;
}
$blogs = MslsBlogCollection::instance();
$language = $blogs->get_current_blog()->get_language();
$msla = new MslsLanguageArray( my_get_input_array( $object_id ) );
$options = new $class( $object_id );
$temp = $options->get_arr();
if ( 0 != $msla->get_val( $language ) ) {
$options->save( $msla->get_arr( $language ) );
}
else {
$options->delete();
}
foreach ( $blogs->get() as $blog ) {
switch_to_blog( $blog->userblog_id );
$language = $blog->get_language();
$larr_id = $msla->get_val( $language );
if ( 0 != $larr_id ) {
$options = new $class( $larr_id );
$options->save( $msla->get_arr( $language ) );
}
elseif ( isset( $temp[ $language ] ) ) {
$options = new $class( $temp[ $language ] );
$options->delete();
}
restore_current_blog();
}
}
my_get_input_array( $object_id ) {
$arr = array();
$current_blog = MslsBlogCollection::instance()->get_current_blog();
if ( ! is_null( $current_blog ) ) {
$arr[ $current_blog->get_language() ] = (int) $object_id;
}
$input_post = filter_input_array( INPUT_POST );
if ( is_array( $input_post ) ) {
foreach ( $input_post as $key => $value ) {
if ( false !== strpos( $key, 'msls_input_' ) && ! empty( $value ) ) {
$arr[ substr( $key, 11 ) ] = (int) $value;
}
}
}
return $arr;
}
Hope this will help