WPML support for post type switcher plugin

Post Type Switcher is an excellent plugin that allows you to easily move a post from one post type to another. However, the plugin does not work with WPML due to the way WPML stores its translations. Adding this small code snippet to the plugin’s PHP file makes it compatible. 

Open “Post Type Switcher” plugin PHP file

It is located at wp-content/plugins/post-type-switcher/post-type-switcher.php

Find lines

// Update post type
$data['post_type'] = $post_type;

Add this code above

// Update WPML translations as well
global $wpdb, $sitepress;
include_once( WP_PLUGIN_DIR . '/sitepress-multilingual-cms/inc/wpml-api.php' );

$post_trid = apply_filters( 'wpml_element_trid', NULL, $postarr['ID'], 'post_' . $data['post_type'] );
$translations = apply_filters( 'wpml_get_element_translations', NULL, $post_trid, 'post_' . $data['post_type'] );

if( is_array( $translations ) && !empty( $translations ) && function_exists('icl_object_id') ) {
  foreach( $translations as $translation ){
    $elem_id = $translation->element_id;

    // skip currently switched element
    if ( $elem_id == $postarr['ID'] ) continue;

    // Set the new post type.
    set_post_type( $elem_id, $post_type );

Source: https://www.grzegorowski.com/wordpress-wmpl-post-type-switcher-support/