There is no problem not worth solving, and no technology not worth learning!

WordPress adds article classification labels multi-language pre-translation process

配图说明(如图10):中文、英文分类管理页面截图(分屏对比),标注两个页面的分类总数,演示数量一致/不一致的场景。

作者:

,

Practical Guide to Making a WordPress Blog Multilingual

查看按语言划分的用户统计,排名前 4 的语言(英语、中文、印尼语、越南语)(如图3)

(1) Blog Multilingual Decision | Why did I decide to spend time doing multilingual? (with real discovery)

Blog multi-language plug-in selection|Free VS payment, server VS browser, measured comparison + configuration tutorial

(2) Blog multi-language plug-in selection|Free VS payment, server VS browser, measured comparison + configuration tutorial

附上我翻译完成后的分类效果截图(如图11),中文与英文的分类总数相等

(3) Blog Category Translation Practice | 695 categories, 4-hour manual translation whole process (Guide to the pit)

最后分别查看中文与英文后台下的标签统计,符合预期。如图17

(4) Blog Label Translation Practice | 8060 tags, the whole process based on PHP scripts

如图11:最终效果,在前台,语言切换器的显示

(5) Blog menu translation practice

如图20对应场景:网站前台效果,顶部语言切换器(中文/英文),点击英文后,网站整体切换为英文版本,文章列表按发布时间倒序排列(与中文文章排序一致),点击任意英文文章,可正常查看,语言切换流畅;同时,英文文章的发布时间、分类、标签与中文原文完全对应,URL路径规范,SEO友好。

(6) WordPress Multilingual Blog Article Translation Practical Records (Polylang plugin, attached guide)

配图说明(如图10):中文、英文分类管理页面截图(分屏对比),标注两个页面的分类总数,演示数量一致/不一致的场景。

(7) WordPress adds article classification labels multi-language pre-translation process

完成后,访问中文系列页 https://你的域名/series/self-hosted-vpn-series/,点击顶部的 English 切换按钮,就能正常跳转到 https://你的域名/en/series/self-hosted-vpn-series-en/ 了。如图13

(8) Farewell Manual Numbering: Elegantly Manage WordPress Series Articles with PublishPress Series

WordPress Classic Editor Block Non-Destructive Migration: Batch Convert SyntaxHighlighter Shortcodes to Gutenberg Blocks

(9) WordPress Classic Editor Block Non-Destructive Migration: Batch Convert SyntaxHighlighter Shortcodes to Gutenberg Blocks

After clicking the translation button, you will encounter a pop-up window “mysterious” flashback problem and solution

(10) After clicking the translation button, you will encounter a pop-up window “mysterious” flashback problem and solution

中文标签出现冗余新增(如图2),数据彻底错乱。

(11) WP 6.9 Tag Synchronization Script In WP 7.0 Complete Troubleshooting and Solution Records

重点避坑:仅勾选数据库无法完成数据还原,选中库之后,右侧数据表列表点击全选,囊括库内所有数据表(如图3)

(12) Alibaba Cloud RDS database is damaged by misoperation, complete backup and recovery practical pit guide

为了看起来更完善,AI会主动新增非必要的清理、校验、适配逻辑,简单需求复杂化,大幅增加报错和风险概率(如图7)

(13) AI generates code to avoid the pit: the database operation code must not be directly executed online

WordPress Label Cleanup Practice (1): Failed attempts to match the big language model

(14) WordPress Label Cleanup Practice (1): Failed attempts to match the big language model

在宿主机的 output 目录下可以找到生成的 tag_mapping_result.csv。打开文件查看,结果格式规整,符合预期。

(15) WordPress tag cleaning practice (2): Go script engineering implementation

脚本执行后(如 图 6 终端日志所示),系统开始成对合并中英文标签。

(16) WordPress Label Cleanup Practice (3): Perfectly solve the problem of Polylang synonymous tag merger

图7:展示了浏览器开发者工具Network面板中,旧URL 301跳转至新URL的成功记录

(17) WordPress tag cleaning practice (4): Realize WordPress Chinese and English tag merge and URL automatic jump based on Go script

截图 5:验证 301 跳转

(18) WordPress tag cleaning practice (5): Solve the problem of Chinese labels remaining in the English language based on the php/go script, and realize the automatic tag merge and url jump

脚本显示处理了 8324 个标签

(19) Troubleshooting and Repairing the Accuracy of WP Label Batch Translation Scripts

图5:DeepL API 注册页面,国家或地区列表中没有中国大陆

(20) Why Is It So Hard to Improve English Translation Quality for a WordPress Blog in Mainland China? A Polylang, AutoPoly, and DeepL API Troubleshooting Recap

图5:DeepSeek 的评分结果截图

(21) Chrome Built-in AI vs Yandex Translate vs ChatGPT Plus: Why I’m Moving Important English Blog Posts to ChatGPT Plus

[截图 2:浏览器 Network 中直接请求 translate.yandex.net]

(22) From AutoPoly to Yandex Web: Validating Automatic English Translation Quality for WordPress

【图1:AutoPoly Free 与 Pro 功能对比截图】

(23) Can AutoPoly Pro + OpenAI API Automate WordPress English Translation? A Feasibility Analysis from Workflow to Payment

【图2:点击“立即试用”后,ChatGPT 输入框中出现“代理模式”】

(24) Can ChatGPT Agent Replace ChatGPT Plus for WordPress English Translation Rewrites?

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.

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.

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.

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.

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

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 <Total number of Chinese", and it is clear that the new label needs to be added;


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;

Figure 5: 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.

As shown in Figure 6: After the script is executed, the English label management page will take a screenshot, label the automatic completion of the label list, and confirm that it is exactly the same as the new 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.

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).

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;

Figure 8: Screenshot of the "Add Category" page in the English category, mark 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.

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.

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.

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.

WordPress Multilingual Blog Article Translation Practical Records (Polylang plugin, attached guide) Farewell Manual Numbering: Elegantly Manage WordPress Series Articles with PublishPress Series

WordPress Maintenance, Performance Optimization & Blog Growth Consulting

I have been running my personal technology blog for more than 10 years and have published over 1,000 original articles. My long-term practice covers WordPress website maintenance, CDN / Cloudflare configuration, caching optimization, Google SEO, ad monetization, and multilingual website operations.

If your WordPress website is slow, unstable, affected by plugin conflicts, showing caching issues, having AdSense display problems, or facing CDN / Cloudflare / DNS configuration uncertainty, feel free to contact me for remote troubleshooting.

Ideal For:
✅ Personal blog owners
✅ WordPress website operators
✅ Independent developers and content creators
✅ SaaS website owners
✅ Website owners who want better speed and stability

What I Offer:
✅ WordPress performance optimization
✅ Cloudflare / CDN / caching configuration checks
✅ Plugin conflict and layout issue troubleshooting
✅ AdSense display issue troubleshooting
✅ Basic SEO structure review
✅ Blog growth and monetization consulting

If you would like to discuss your website, please contact me and mention: WordPress Maintenance Consultation.

Contact Me:
Telegram: @shuijingwan
WeChat: 13980074657
Email: shuijingwanwq@gmail.com

评论

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.