enter the function name to search:
Content Management

Wenprise Pinyin Slug Plugin - Automatically converts Chinese post aliases, category aliases, and image filenames in WordPress URLs to Hanyu Pinyin or English translations.

Posted in:
Update time:2023-12-21

We offer WordPress Themes and Plugins Custom Development Services

This site has long undertaken WordPress themes, plugins, WooCommerce-based store mall development business. We have 10 years of experience in WordPress development, if you want to Developing Websites with WordPress, please contact WeChat: iwillhappy1314 or email: amos@wpcio.com for inquiries.

86 thoughts on “Wenprise Pinyin Slug 插件——自动转换 WordPress URL 中的中文文章别名、分类项目别名、图片文件名称为汉语拼音或英文翻译

  1. Nice, replaced the two plugins I was using before with one.

  2. Nice stuff, national stuff or national understanding, quite a bit better than that so pinyin for foreigners! Thanks for the knife.

    1. The plugin only works on posts without aliases (newly published or manually deleted existing aliases), posts with existing aliases remain as they are.

      1. Yes, there is. Is there a way to batch convert articles and categories with "existing aliases". It only works for new ones.

        1. Ok, I'll test it and if I can reproduce the problem, I'll release a new version after fixing it, just update it in the background.

  3. How do I disable the filename conversion on upload, it conflicts with another plugin I have?

  4. Good plugin, image uploads are also able to convert slugs automatically.
    However, I'm running into a situation with the plugin where the contributor role logging into the backend also sees the settings page of the Wenprise Pinyin Slug plugin?

  5. After installing it comes up with "The plugin does not have a valid title."

  6. The following error occurs after the installation is enabled:

    "Your site has encountered a fatal error, please check your site's administrative e-mail for guidance.

    Learn more about debugging in WordPress."

    WordPress: version 5.3.2
    PHP: PHP 7.2 (ea-php72)

  7. Still the same error. Try WP_DEBUG set to true, which displays the following additional message:
    Fatal error: require_once(): Failed opening required '/wp-content/plugins/wpforms-lite/includes/providers/class-constant- contact. contact..php' in /wp-content/plugins/wpforms-lite/includes/class-providers.php on line 55
    Your site has encountered a fatal error, please check your site's administrative e-mail address for guidance.
    I don't think it has anything to do with wp_forms does it?

    1. After looking at it, it might really be a bug in wp-forms, here is the relevant code in the wp-forms plugin that reports the error.

      foreach ( $providers as $provider ) {
          $provider = sanitize_file_name( $provider ) ;
          require_once WPFORMS_PLUGIN_DIR . 'includes/providers/class-' . $provider . '.php';
      }

      sanitize_file_name The output of the function already carries a dot at the end of the result.require_onceThat line, the last ".php" with another point, which led to the error report in the "class-constant-contact..php", remove the extra point, both plug-ins can be opened normally.

      It appears that this file is not loaded until the Wenprise pinyin slug is enabled, which can be done by enabling wp forms alone. As to why enabling the Wenprise pinyin slug plugin causes wp forms to load this file. Need to investigate further.

      1. Yes, it's true that removing the extra dot, both plugins can be enabled normally. However, when no changes are made to wp forms and only the Wenprise pinyin slug is disabled, wp forms outputs "class-constant-contact.php" normally without this extra dot. Only when Wenprise pinyin slug is enabled, the extra dot will appear. In addition, if you change wp forms to remove the dot and then disable Wenprise pinyin slug, it will also cause wp forms to report an error, and the file "class-constant-contactphp" will not be found.

        1. In that case, it may indeed be a problem with my plugin with modifications sanitize_file_name function's output, I'll test it later.

        2. Released a new version that fixes the issue, just update it in the background. Thank you for your feedback 🙏

    1. Previously, batch conversion of articles would result in the original links not being accessible, leading to loss of weight. So this feature will not be added.

  8. The new version of the translation doesn't work anymore
    Version 1.4.13
    PHP 7.3
    WordPress 5.4
    Using Baidu Translate, which has always worked. Now the translation is directly the first few (full spelling) or initial letters of pinyin, which used to be able to translate into English, but now it can't.

    1. You can try re-saving the plugin settings, if it doesn't work, I'll test it and fix it in the next version.

      1. 1、Disable/Enable plug-in
        2. Initial/full spelling and save changes respectively
        Separate tests are not translations but titles into initials or pinyin for the first few words of the title.
        I've confirmed it over and over again, so I'm begging the gods to update it as soon as possible

          1. The latest version is 1.5.0, you can update it directly from the background, if the translation still can't be used after updating, add my QQ during office hours to help you check it out.

          2. Make sure it's version 1.5.0. Select Baidu Translate to generate pinyin initials (why have this option that has no recognizable meaning).

          3. Already gave feedback on QQ, describing the problem again:
            After repeated testing Baidu Translate is effective, but with the alias set to the length of characters related to
            ① For example, the title has 100 characters (that is, for example), set the alias length of 20 characters, then it will not be translated but directly display the first letter of the title, that is, we believe that the translation did not take effect;
            ② For example, the title is 19 characters (that is, for example), set is 20 characters alias length, then at this time Baidu Translate will be automatically translated into the cause of the text, that is, we believe that the translation is in effect.
            Regardless of the formality of whether the translation was successful or not, in both modes, I confirmed that the translation was recorded in the background of Baidu Translate.
            ———–
            But forward 2 versions, my default setting is 15 characters, no matter how long the title, will call the Baidu translation, may not be fully translated but the title specification, which is me or most of the "white people" want the function.
            Ask the gods to solve this need.

          4. A new version has been released, please update to test it.

            In translation mode, the alias length should not be set too short, as this may lead to alias duplication by rounding off the last word after the alias degree limit is reached.

          5. Upgrading to version 1.5.1 solves the problem perfectly.
            Thanks to the gods for their selflessness and godly handling of the problem.

  9. Great plugin, wish I could add a feature:

    Add a timestamp or a random code to the file name individually, to avoid the file link being guessed by others (needed by paid resource sites), and to reduce excessive resource consumption due to files with the same name (if a user uploads 100 images with the same name in "Chinese", WP will retrieve all the attachments with the same name, and then add the number tail), which is a resource-consuming process. This process is very resource-consuming, but of course, this example is quite extreme.)

    Or consider adding hooks for the corresponding translation functions so that those who need them can customize the

    1. Adding hooks to the translation function should be a better solution, consider adding it in the next release.

        1. A new version has been released, refer to the code below.

          add_filter('wenprise_converted_slug', function ($slug, $name, $type)
          {
              return $slug . 99.
          }, 10, 3);

          $slug is the converted alias, $name is the pre-conversion, $type is the conversion type, and possible values are: post, term, file

          1. After testing just now, I found that your hook only works if the filename contains Chinese, and it doesn't work for filenames that don't have Chinese. So it is still recommended to add a new hook for the end of the filename translation to ensure that non-Chinese filenames can also add timestamps and so on, thank you!

  10. Plugin can not recognize the number, how to make him enter the title automatically converted, otherwise I am afraid to submit the URL is not correct.

  11. This does not automatically translate the post alias in the new category of the Custom Post Type UI plugin!

  12. How do I change my role permissions?
    Right now it's only valid for administrators, if it's contributor or author access, the tag names they add are still in Chinese.
    The main administrator is valid and would like to add to be available to other roles as well.

    1. Setting post tags is done when publishing a post. The roles below the editor do not have the permission to publish posts, so they cannot realize the function of this plugin. This is the default permission setting of WordPress, this plugin will not change this setting, and it is not recommended to change it by other methods, as there may be security issues after modification.

  13. Boss, it's working well, thanks for the tool, but I found that when I convert ǚ to yu, such as couple, after converting "qing-lyu", it should be "qing-lv", right? I hope you can correct it, thanks for your hard work.

    1. This issue does not affect the functionality of the plugin and will not be revised, if a correction is definitely needed, you can use the wenprise_converted_slug Filter to replace it to achieve the effect you need.

  14. Thank you for your prompt reply, I don't know if it affects Baidu's inclusion, because the url is translated into pinyin, such as qing-lyu in Baidu is not corresponding to the "couple", and if it is "qing-lv" Baidu will know that right away! If it can be corrected whether it is more perfect, thank you boss point to use the replacement tool, I try, thank you!

  15. By the way, boss wenprise_converted_slug Filter where to download this plugin, Baidu can not find? I can't find it on Baidu.

  16. 遇到一个问题,文章标题中带有字符例如“·”,URL中会被翻译成“-%c2%b7-”,能否去掉标题中的字符?

  17. This plugin is very well written, and I'm here to give you advice that
    Ichabod said:
    2018/08/20 08:10
    The plugin only works on posts without aliases (newly published or manually deleted existing aliases), posts with existing aliases remain as they are.

    I hope to change it, when fast editing, manually change the alias to Chinese, save it, and then convert it to English, it is better to support batch editing and saving, the

    The plugin WP Slug Baidu Translate does just that.

    1. I don't use this feature and haven't received feedback that it doesn't work, I'll test it sometime.

  18. Boss, why turn to pinyin such as the correct address is: http://www.touxiangpai.com/gui-mie-zhi-ren.html, but Baidu included in the home page shows www.touxiangpai.com/?p=10 ..., click Baidu snapshot into the discovery: Baidu and webpage http://www.touxiangpai.com/%3Fp%3D10280 The author of this has nothing to do with it. The address has changed again, I wonder if it has anything to do with your plugin? Thanks!

  19. By the way, Boss, I found that both the converted pinyin address and the pre-conversion address can be accessed effectively, which results in both being indexed by Baidu. Can we just keep the converted pinyin address to avoid the one before conversion to be included, thanks!

    1. This is not an issue that this plugin is meant to address, and you may need to find out if there is a related SEO plugin.

  20. In Gutenberg editor mode, aliases are not displayed when you create a new article, they are only generated automatically when you write a title and save a draft or publish.
    Can it be optimized to automatically generate aliases when you write the title and enter or click on the body, so that it is easy to edit the aliases twice.

    1. Considered this approach, ran into difficulties implementing it, will keep trying when I have time.

  21. In the case of conversion to English, labels are not converted always with initials instead.

  22. Now Baidu Translate to English doesn't work? Can you update it?

  23. Hi, is the plugin still being updated, the existing tags, when clicking on Edit and Quick Edit, do not translate, only the re-added tags do!

    1. This is a normal feature of the plugin, for SEO security, the plugin will not convert published articles or category slugs, it will only convert the slug of the newly published content. if you need to convert the slug of the published content, you can try to delete the slug of the existing content and then save it, and it should trigger the auto-conversion operation.

      1. Tags are structured by id, aliases and ids can be turned on, tens of thousands of articles, tens of thousands of tags, deleted in the addition is not realistic, or thousands of articles have to be changed, in fact, you can add a switch, whether or not to turn on the already existing tag conversion. There are some words will not be turned? For example, the perfect world.

  24. I want to use Baidu Translate, filled in the appid and key key effect, still default pinyin

  25. Manually add the category and the alias is set to English, the article is a number id.html or the alias is already set. Wouldn't the plugin automatically translate if these actions exist above?

目前不开放注册.

Do you need to build a website? Do you need to develop a WordPress theme or plugin? Do you have problems using WordPress? We can help you solve all WordPress-related problems.