WordPress adds article classification labels multi-language pre-translation process
Foreword: To undertake the sixth article of this series ‘Part 5: WordPress Multilingual Blog Translation Practical Records (Polylang) Plug-in, with pit guide)’, Part 6 focuses on the complete process of ‘translation of the full text of the stock Chinese blog into English’, and in the actual operation, we will continue to add Chinese articles—— These new articles will be accompanied by new categories and new labels. If the text of the article is directly translated, problems such as classification/label language will be disordered, the association will be invalidated, and the front desk will be abnormally displayed. The core of this article is ‘Add Preparation for Multilingual Translation of Chinese Articles’, and the key explanation: Add the pre-translation logic of new classification/tags , label script copying skills, classification manual translation methods, and minimalist skills to quickly check for missed translations with ‘total number verification’, the whole process is combined The POLYLANG plugin is actually operated, with screenshots (accurately marked with a place to occupy the place), to help you avoid all the pits of pre-translation.
1. Pre-cognition: Why do new articles must be translated first and then the text?
Core logic: In the WordPress multilingual site (Polylang plugin), the classification and label belong to the ‘global attribute’, and the article and the category/tag are ‘associated binding’ relationship. If the text of the article is translated first, and then the English translation of the supplementary category/tag is supplemented, it will lead to:
– The article cannot normally be associated with English categories/labels, and the front desk English site displays ‘no category’ and ‘no label’;
2. Preparation: Polylang plug-in basic configuration check (to ensure that the classification label can be translated normally,)
Before starting a new classification/label translation, it is necessary to confirm that the Polylang plug-in configuration is correct to avoid translation failures due to basic settings, and focus on checking 3 core settings (to undertake the configuration of the sixth chapter and supplement the new scenarios).
2.1 Confirm that the Chinese and English languages have been added normally
Operation path: WordPress background → polylang → language → Confirm that ‘Chinese (Simplified)’ and ‘English (United States)’ have been added, and the default language is Chinese (consistent with the new article language).
The description of the picture (as shown in Figure 2): Screenshot of the Polylang language management page, mark the Chinese and English language entries, and the default language setting location.

2.2 Optimization of synchronization settings
Operation path: WordPress background → Polylang → Settings → Synchronization, synchronization options include: classification, custom field, comment status, ping status, top article, published date, article format, parent page, page template, page order, featured picture (Note: There is no ‘label’ option in the synchronization options). In practice, it is found that there is no need to check other synchronization options. When translating articles, the classification and labels will be automatically synchronized, and the English articles will automatically match the classification and labels of the corresponding Chinese articles. This is polylang. The default feature of the plugin – when creating a new translation, it will automatically copy the metadata such as the classification and labels of the source articles. Therefore, the synchronous setting will give priority to check ‘Release Date’ to ensure that the publishing date of Chinese and English articles is the same; for the problem of inconsistent with the format of the classic editor, after the actual operation is verified, after checking the ‘Article Format’ synchronization option, the newly translated English articles (whether Using the classic editor or the Gutenberg editor), it can be consistent with the format of the Chinese source article, which completely solves the problem of the confusion of the classic editor format. There is no need to test it, just check it directly, and it will not affect other configurations of the site.
With drawings (Figure 3): Polylang The synchronized setting page screenshot, the complete list of the synchronization options (no label option), clearly marked two must-check positions of ‘Publishing Date’ and ‘Article Format’, explaining the effect that can be achieved after checking (the date is the same and the format is unified), and there is no need to test and operate directly.

3. Core practical operation: add label translation (no need to complete one by one manually, auxiliary verification and copy of PHP script)
Core rules: Chinese labels are added, and the English version does not require manual translation, just copy the name of the Chinese label directly as it is (avoid the semantic deviation of the label after translation, and the user search does not match). PHP can be used in practice Script-assisted operation, the script can be run in the server, the core function is: query the labels under all Chinese languages, and automatically verify whether there is any The corresponding English translation, if not, the Chinese label is automatically copied as an English label to complete, without manual search or batch operation, which is efficient and accurate. Example: Added Chinese article tag list as ‘coloros, Google account security verification, security code, GMS, security and login, login Google, Google mobile service, Google service framework, OnePlus 12, OnePlus 12’, you can quickly complete the English label completion through this script.
3.1 Step 1: Add Chinese label and record (basic preparation)
Operation path: When adding a Chinese article, in the ‘Label’ input box of the article editing page, add the corresponding label (such as ‘coloros, Google account security verification’ in the example, etc.), and save the article after the addition is complete. There is no need to manually record the labels, and the subsequent scripts will automatically query all Chinese labels without additional operations.
The picture description (Figure 1): Screenshot of the ‘label’ input box of the WordPress article editing page.

3.2 Step 2: Run the PHP script to automatically verify and complete the English label
Operation steps (script running related):
3.2.1. Step 1: Prepare the PHP script (written or obtain by yourself), confirm that the script can run normally, and the core function is ‘Query Chinese label, verify English label, automatic copy and complete’;
polylang-batch-zh-to-en-tags.php
<?php
if (php_sapi_name() !== 'cli') {
die("❌ 请在命令行运行\n");
}
require __DIR__ . '/wp-config.php';
global $wpdb, $polylang;
// 配置:一次处理多少个,你可以根据自己的服务器调整
$per_page = 1000;
// 配置:源语言和目标语言,以后其他语言直接改这里就好
$source_lang = 'zh';
$target_lang = 'en';
echo "🚀 开始批量处理所有{$source_lang}标签,自动添加{$target_lang}翻译(分页模式)...\n\n";
$processed = 0;
$skipped = 0;
$offset = 0;
while (true) {
// 分页拿源语言标签
$terms = get_terms([
'taxonomy' => 'post_tag',
'lang' => $source_lang,
'hide_empty' => false,
'number' => $per_page,
'offset' => $offset,
]);
if (is_wp_error($terms) || empty($terms)) {
break;
}
$current_count = count($terms);
echo "📊 正在处理第 " . ($offset + 1) . " - " . ($offset + $current_count) . " 个标签...\n";
foreach ($terms as $term) {
$source_id = $term->term_id;
$name = $term->name;
$slug = $term->slug;
// 检查是不是已经有目标语言的翻译了
$target_id = pll_get_term($source_id, $target_lang);
if ($target_id) {
$skipped++;
continue;
}
echo "🔰 正在处理: {$name} (ID: {$source_id})\n";
// 创建目标语言标签,绕过slug重复检查
$wpdb->insert($wpdb->terms, [
'name' => $name,
'slug' => $slug,
'term_group' => 0
]);
$new_target_id = $wpdb->insert_id;
// 目标语言标签的taxonomy
$wpdb->insert($wpdb->term_taxonomy, [
'term_id' => $new_target_id,
'taxonomy' => 'post_tag',
'description' => '',
'parent' => 0,
'count' => 0
]);
// 设置目标语言
$polylang->model->term->set_language($new_target_id, $target_lang);
// 绑定翻译
$polylang->model->term->save_translations($source_id, [
$target_lang => $new_target_id
]);
$processed++;
}
$offset += $per_page;
unset($terms);
gc_collect_cycles();
}
echo "\n🎉 全部处理完成!\n";
echo "📊 统计:\n";
echo " 已处理新标签: {$processed}\n";
echo " 已跳过已有翻译: {$skipped}\n";
echo "\n✅ 所有标签都已经处理完毕,和手动添加的完全一样!\n";
3.2.2. Step 2: Upload the PHP script to the server directory corresponding to the WordPress site (make sure that the script has the corresponding running permission to avoid failure to run);
3.2.3. Step 3: Run the PHP script on the server and wait for the script to complete (the execution time depends on the number of tags, and the number of tags will be completed in seconds).
3.2.4. Step 4: After the script is executed, enter the WordPress background. There is no manual operation. The script has automatically completed all English tags that are not synchronized.
As shown in Figure 4: Comparison screenshots of Chinese/English label management pages, marked the difference between the total number of the two, and demonstrates the scenario of ‘Total English

Core operation: upload the prepared PHP script to the server and run the script in the server. The script will automatically perform the following operations without manual intervention: 1. Query all the tags under all Chinese languages (including the newly added article tags); 2. Check each Chinese label one by one, and confirm whether there is a corresponding tag under the same name in the English language (no need to translate, directly match the name); 3. If there is no corresponding label under the English language, the script will automatically copy the Chinese label and add it to the English label list as an English tag to complete the completion.
3.3 Step 3: Check the tag after synchronization (to ensure that there are no omissions)
Operation path: WordPress background → Article → Labels → Switch to English language (top language switching button), check the number and name of the tag after synchronization, and confirm that it is exactly the same as the new label in Chinese.
Description of pictures (2 in total):
3.3.1. As shown in Figure 5, the screenshot of the interface running the PHP script in the server, the annotation script runs the command, the execution status (such as ‘processing’ and ‘processing complete’), and the prompt message of the successful execution of the script;

[root@iZ23wv7v5ggZ www.shuijingwanwq.com]# php polylang-batch-zh-to-en-tags.php
🚀 开始批量处理所有zh标签,自动添加en翻译(分页模式)...
📊 正在处理第 1 - 1000 个标签...
📊 正在处理第 1001 - 2000 个标签...
🔰 正在处理: ColorOS (ID: 35286)
📊 正在处理第 2001 - 3000 个标签...
🔰 正在处理: GMS (ID: 35292)
🔰 正在处理: Google服务框架 (ID: 35300)
🔰 正在处理: Google移动服务 (ID: 35298)
📊 正在处理第 3001 - 4000 个标签...
🔰 正在处理: OnePlus 12 (ID: 35302)
📊 正在处理第 4001 - 5000 个标签...
📊 正在处理第 5001 - 6000 个标签...
📊 正在处理第 6001 - 7000 个标签...
🔰 正在处理: 安全性与登录 (ID: 35294)
🔰 正在处理: 安全码 (ID: 35290)
📊 正在处理第 7001 - 8000 个标签...
🔰 正在处理: 登录Google (ID: 35296)
🔰 正在处理: 账号安全验证 (ID: 35288)
📊 正在处理第 8001 - 8069 个标签...
🎉 全部处理完成!
📊 统计:
已处理新标签: 9
已跳过已有翻译: 8060
✅ 所有标签都已经处理完毕,和手动添加的完全一样!
3.3.2. As shown in Figure 6: After the script is executed, the English label management page will take a screenshot, mark the automatic completion of the label list, and confirm that it is exactly the same as the newly added label in Chinese, and there is no need to manually complete it.

4. Core practical operation: new classified translation (manual translation, advance search + entry)
Core rules: The classification is different from the label, which needs to reflect the level of the site column and the English semantic accuracy. It cannot be directly copied in Chinese. Search in the background, confirm that the category has not been translated, and then enter.
4.1 Step 1: Add Chinese classification (accurate positioning to avoid missed translation)
The picture description (as shown in Figure 1): Screenshot of the ‘Classification’ input box of the WordPress article editing page.

4.2 Step 2: Retrieve whether the classification has been translated (critical steps, avoid repeated translation)
Operation path: WordPress background → Polylang → Category → Switch to English language → Enter the Chinese category name (or the translated English name) in the ‘Search Box’, and search for whether there is a corresponding category:
– If it is retrieved, it means that the category has been translated, and there is no need to repeat the operation;
– If it is not retrieved, it means that the classification is not translated, and the next step is to manually translate and enter.
The description of the picture (Figure 7): Screenshot of the Polylang classification management page, the labeling language switching button, the search box, and the prompt ‘Result not retrieved’ (corresponding to the untranslated classification scenario).

4.3 Step 3: Manually translate and enter English classification (standardized operation to avoid confusion)
Operation steps:
1. On the Polylang classification management page (Chinese language), click ‘+’;
2. Enter the translated English category name (it needs to fit Chinese semantics, refer to industry specifications, such as ‘Technical Course’ is translated as ‘Tech Tutorials’, rather than literally ‘Technology Course’);
3. Copy the description of the Chinese classification (if any), and enter the English classification description after translation (maintain the semantics is consistent, concise and clear);
4. In the ‘Association’ drop-down box, select the corresponding Chinese category (realize the Chinese and English classification and avoid the association failure);
5. Click ‘Add Category’ to complete the English category entry.
Description of pictures (2 in total):
1. As shown in Figure 8: Screenshot of the ‘Add Category’ page in the English category, indicate the English name, describe the entry position, and select the method of the ‘Association’ drop-down box;

2. As shown in Figure 9: Screenshot of the English classification list after the addition is completed, label the associated Chinese classification, and confirm that the entry is successful.

4.4 Step 4: Classify post-translation verification (to ensure the correct association)
Operation path: Switch back to the Chinese classification management page, find a new category, check the ‘Language’ column, and confirm that the corresponding English classification has been displayed (explain that the association is successful); at the same time, switch to the English classification page to confirm the category name and description are correct.
The description of the accompanying picture (as shown in Figure 9): Screenshot of the Chinese classification management page, marked with the ‘language association’ display position, and confirm that the English classification has been successfully associated.

5. Minimalist pit avoidance skills: use ‘total number verification’ to quickly check and miss the translation (core efficient)
There is no need to check each category and label one by one, just through the ‘Comparison of the total number of Chinese/English categories and total number of labels’, you can quickly judge whether there are new entries for omission/leak synchronization, which is suitable for batch new scenarios, saving a lot of verification time.
5.1 Category Total Check Method
Operation path:
1. WordPress background → Article → Category → Switch to Chinese language and view the total number of categories (labeled as ‘Chinese classification number’);
2. Switch to English language and check the total number of English categories (marked as ‘English classification’);
3. Compare the two totals: if the number is the same, there is no omission translation; if the number of English categories is less than Chinese, it means that there are new Chinese categories that have not been translated, and you can make up for them.
The accompanying diagram description (as shown in Figure 10): Screenshot of the Chinese and English classification management pages (split screen comparison), label the total number of classifications on the two pages, and the scenarios where the number of demonstrations is consistent/inconsistent.

5.2 How to check the total number of labels
The operation path is the same as the classification:
1. WordPress background → Articles → Labels → Switch to Chinese language and view the total number of tags;
2. Switch to English language and check the total number of English tags;
3. Compare the two totals: if the number is the same, it means that the script synchronization is successful, and there is no leakage synchronization; if the number of English tags is less than Chinese, it means that the script synchronization failed, and the script can be re-execute.
6. Summary: Added the complete process of multilingual translation of articles (simplified version)
Combined with the actual operation of this article, we have added a complete pre-+ body process of multilingual translation of Chinese articles, which can be directly compared, and efficiently without errors:
1. Add Chinese articles to determine the classification and labels of articles (new categories/tags for records);
2. Pre-operation 1: Add a label → use the script to synchronize with one key to English (the total number of verification after synchronization);
3. Pre-operation 2: New classification → Manual translation → Search for untranslated categories → Enter the English category and associate the Chinese classification (check the correlation and total number after entry);
4. Post-operation: Translate the text of the article (refer to the practical operation of the sixth article), associate the translated English categories/labels, and publish the English translation.