[Plugin: WordPress Multi Language] compatibility with Post Type Switcher
-
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://ww.wp.xz.cn/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 theupdatemethod.Here’s the code:
// in case of using the WPML plugin if(function_exists('icl_object_id')){ // 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'){ if(is_array($post->ancestors)){ $ID = $post->ancestors[0]; } }else{ $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?
Cheers,
The topic ‘[Plugin: WordPress Multi Language] compatibility with Post Type Switcher’ is closed to new replies.