Issue: Translation is faulty or not updated
During the operation of a multilingual website with TranslatePress, sometimes you will encounter cases where the translation is faulty (for example: Chinese is displayed as Vietnamese) or you want to reset the entire translation of a specific post so that the AI translates it again from scratch.
This post will guide you through 2 ways to completely delete the translation of any post (Post, Page, Product…) without affecting other posts.
Method 1: Delete using SQL (Most Accurate)
This is the safest and most accurate method, helping you thoroughly delete data in the database.
Step 1: Find the Post ID
Access the WordPress admin page, go to the section Posts or Pages. Hover the mouse over the title of the post you want to process, look down at the browser's status bar, you will see the number ID https://dps.media/wp-content/uploads/2025/07/27798-gia-dich-vu-lam-tich-xanh-facebook-va-bang-so-sanh-cac-goi-pho-bien-754x402.jpg post=123).
Step 2: Determine the post code and language table
- Post ID: For example, it is
123 - Language code to delete: For example, Chinese (China) is usually
zh_cn, English isen_us. The table name in the database will be in the formwp_trp_dictionary_vi_zh_cn(if translating from Vietnamese to Chinese).
Step 3: Run the SQL command
Open phpMyAdmin (or similar database management tool), find the website's database and run the following command:
-- Thay '123' bằng ID bài viết của bạn
-- Thay 'wp_trp_dictionary_vi_zh_cn' bằng tên bảng ngôn ngữ bạn muốn xóa
DELETE FROM `wp_trp_dictionary_vi_zh_cn`
WHERE `original_id` IN (
SELECT `original_id`
FROM `wp_trp_original_meta`
WHERE `meta_key` = 'post_parent_id'
AND `meta_value` = '123'
);
After running, the entire translation of that post will be deleted. You just need to go to the homepage and reload the page, the system will automatically translate it anew.
Method 2: Use PHP Code (Quick and Simple)
If you are not familiar with databases or do not want to touch phpMyAdmin, you can use the following small piece of code.
Step 1: Add code to functions.php
T-5 days functions.php of the active theme (Appearance -> Theme Editor), and add this code to the end of the file:
add_action('init', function() {
// Thay đổi số 123 thành ID bài viết bạn muốn xóa
$post_id_to_clean = 123;
// Thay đổi thành mã ngôn ngữ bạn muốn xóa (ví dụ: vi_zh_cn, vi_en_us)
$lang_pair = 'vi_zh_cn';
if (isset($_GET['clean_post_id']) && $_GET['clean_post_id'] == $post_id_to_clean) {
global $wpdb;
$meta_table = $wpdb->prefix . 'trp_original_meta';
$dict_table = $wpdb->prefix . 'trp_dictionary_' . $lang_pair;
// Kiểm tra xem bảng có tồn tại không
if ($wpdb->get_var("SHOW TABLES LIKE '$dict_table'") != $dict_table) {
wp_die("Bảng $dict_table không tồn tại. Hãy kiểm tra lại mã ngôn ngữ.");
}
// Lấy danh sách ID chuỗi thuộc về bài viết này
$original_ids = $wpdb->get_col($wpdb->prepare(
"SELECT original_id FROM $meta_table WHERE meta_key = 'post_parent_id' AND meta_value = %s",
$post_id_to_clean
));
if (!empty($original_ids)) {
$ids_placeholder = implode(',', array_fill(0, count($original_ids), '%d'));
$wpdb->query($wpdb->prepare(
"DELETE FROM $dict_table WHERE original_id IN ($ids_placeholder)",
$original_ids
));
echo "Đã xóa sạch bản dịch cho bài viết ID: " . $post_id_to_clean;
} else {
echo "Không tìm thấy chuỗi nào cần xóa hoặc bài viết chưa được dịch.";
}
exit;
}
});
Step 2: Run the delete command
After saving the file, access the following URL in your browser (log in as admin first):
https://website-cua-ban.com/?clean_post_id=123
(Remember to replace 123 with the post ID you entered in the code).
Step 3: Delete the code
After seeing the message “Successfully deleted translation…”, go back to the file functions.php and delete the code snippet just added for security and to keep the website lightweight.
Conclusion
Above are 2 methods to help you reset the translation for a specific post in TranslatePress. This is very useful when you change the original content too much or when the automatic translation is faulty.
Wish you success!
Ý kiến bạn đọc (9)
Đăng nhập để bình luận
Đăng nhập nhanh 1-chạm bằng Google để chia sẻ ý kiến của bạn về bài viết.
Bằng cách đăng nhập, bạn đồng ý với điều khoản và chính sách cộng đồng.
If I only want to reset the translation of one specific post, could this SQL statement accidentally delete data from other posts? I'm a bit hesitant to work directly on the database.
If the post ID and language table are correctly identified, the post_parent_id condition helps pinpoint the right posts. However, you should still back up the database before running DELETE, especially for a website running in production.
We once did this to reset a mistranslated Product, but first we copied the database to staging, tested the command, and only then ran it for real, which gave us good peace of mind.
After deleting translations, does TranslatePress retranslate automatically right away, or do you have to open the translation editor and run it manually? I'm using AI translation, so I want to reset it and translate from the beginning.
Deleting data only resets the translations. Retranslating also depends on how you configure TranslatePress and which translation tool you use, so don't assume that once you DELETE, the AI will definitely run again right away.
That's right. I've also encountered cases where, after deleting, I had to reload the page and check the target language again. If it hasn't been auto-translated, go to the translation section to reactivate it.
PHP is easier to approach than phpMyAdmin, but remember to delete the code after it has run and don't leave it in functions.php.
For multilingual websites, correctly identifying the language code and table name is very important. Using the wrong table can easily lead to mishandled data.
This article addresses an issue we have faced: an old translation was kept even though the original content had been corrected. Adding a way to check the data before running DELETE would be even better.
Chưa có bình luận nào. Hãy là người đầu tiên chia sẻ cảm nghĩ!
Đăng nhập / Tạo tài khoản
Đăng nhập với Google để gửi bình luận và tương tác cùng cộng đồng.
Tiếp tục là đồng ý với điều khoản sử dụng và chính sách bảo mật của DPS Media.