Hướng dẫn gỡ bỏ qTranslate plugin
qTranslate, một plugin khá hay để tạo giao diện đa ngôn ngữ cho wordpress. Mình cũng đã dùng 1 thời gian nhưng rồi càng ngày càng lười dịch bài viết
và đến giờ thì chả muốn dịch tí nào
cái plugin tự nhiên đâm ra thừa
muốn vứt nó đi nhưng mà disable đi thì thấy nó lỗi tùm lum hết cả
…. cũng lên forum support xem, nhưng làm theo cách trên đó thì phần sau “more” là bị mất
Hôm nay quyết định bỏ nó đi, đọc code 1 hồi cũng tìm ra cách để gỡ bỏ hoàn toàn plugin này:
Bước 1: Backup CSDL của bạn(đề phòng lỗi)
Bước 2: Mở file “qtranslate_configuration.php” tìm đoạn mã:
elseif(isset($_GET['markdefault'])){
// update language tags
global $wpdb;
$wpdb->show_errors();
$result = $wpdb->get_results('SELECT ID, post_title, post_content FROM '.$wpdb->posts.' WHERE NOT (post_content LIKE "%<!--:-->%" OR post_title LIKE "%<!--:-->%")');
foreach($result as $post) {
$content = qtrans_split($post->post_content);
$title = qtrans_split($post->post_title);
foreach($q_config['enabled_languages'] as $language) {
if($language != $q_config['default_language']) {
$content[$language] = "";
$title[$language] = "";
}
}
$content = qtrans_join($content);
$title = qtrans_join($title);
$wpdb->query('UPDATE '.$wpdb->posts.' set post_content = "'.mysql_escape_string($content).'", post_title = "'.mysql_escape_string($title).'" WHERE ID='.$post->ID);
}
$message = "All Posts marked as default language!";
}
Và thay bằng đoạn
elseif(isset($_GET['markdefault'])){
// update language tags
global $wpdb;
$wpdb->show_errors();
$result = $wpdb->get_results('SELECT ID, post_title, post_content FROM '.$wpdb->posts.' WHERE 1=1');
foreach($result as $post) {
$content = qtrans_use('keep_lang', $post->post_content, true);
$title = qtrans_use('keep_lang', $post->post_title, true);
$wpdb->query('UPDATE '.$wpdb->posts.' set post_content = "'.mysql_escape_string($content).'", post_title = "'.mysql_escape_string($title).'" WHERE ID='.$post->ID);
}
$message = "qTranslate was uninstall completely";
}
Bước 3: Vào trang cài đặt của qTranslate, chọn “Advanced Settings”, phần convert database, click vào link “click here to mark all existing posts as written in the default language”
Chú ý: Ở bước 2, thay keep_lang bằng mã của ngôn ngữ mà bạn muốn giữ lại. Ví dụ bạn muốn giữ lại tiếng Việt thì sửa thành
qtrans_use('vi', $post->post_content, true);
còn tiếng Anh thì sửa thành
qtrans_use('en', $post->post_content, true);
Chúc mọi người thành công


Chả hiểu, sáng nay nó mới chậm thế đấy! Ko vào đc Plesk nữa! Chắc cụ maychu có ấy lại trái gió trở trời rùi