[Plugin: WordPress Multi Language] compatibility with Post Type Switcher (1 post)

  1. jan444
    Posted 3 years ago #

    Hello guys,

    I'm trying to make two plugins work together: WP Multi Language and Post Type Switcher.

    Once installed, as soon as I switch a post type into another, it will disappear from the admin area.

    I did some research and found some people who already had this issue, but it's a closed thread and it's unclear to me what to do next.

    - http://wordpress.org/support/topic/post-type-switcher-bug-with-wpml?replies=5

    It appears that Post Type Switcher would need to update the WPML database to take into account the switch. I tried to paste the recomended code at the end of post-type-switcher.php, but it throws an error about the update method.

    Here's the code:

    // in case of using the WPML plugin
    // adjust field 'element_type' in table 'wp_icl_translations'
    // from 'post_OLDNAME' to 'post_NEWNAME'
    // the post_id you look for is in column: 'element_id'
    if($post->post_type == 'revision'){
    $ID = $post->ancestors[0];
    $ID = $post->ID;
    $wpdb->update("{$wpdb->prefix}icl_translations", array('element_type' => 'post_' . $new_post_type_object->name), array('element_id' => $ID));

    Would you know guys of a way to correctly interpret and place that code?


Topic Closed

This topic has been closed to new replies.

About this Topic