[BUG REPORT] Abnormal change of chinese categories and slug
Describe the bug When using Chinese, the "Chinese categories" and "Chinese Slug" when updating articles will be created as new English categories and English Slug.
To Reproduce edit old post , change categories(use Chinese) , save post
Expected behavior i remember old version 3.0.0 is fine.
Screenshots/Errors
HTMLy Version v3.0.8
Server Info (please complete the following information):
- OS: Linux
- Webserver Apache 2.4,
- PHP Version PHP 8.2
Seems like since version 2.9.9 it has this kind behavior, so when using URLify for PHP 7.2+ version it automatically changes to Latin when using URLify::downcode($str);, and this is used when creating slugs, so it ignores existing slugs in Chinese characters and assumes that we are changing categories.
And for the new category/slug, it is actually just temporary, if we edit the post and change it to another category, it will not show up on category selection or category list. As we know, HTMLy automatically creates temporary categories info based on folders, you can add the category info/slug later via dashboard. Read more,
In the future it may be a good idea to have an option to choose this.
To fix it, change the post to another category and save it. Edit admin.php and found this line:
// Clean URLs
function remove_accent($str)
{
return URLify::downcode($str);
}
Just return the $str
// Clean URLs
function remove_accent($str)
{
return $str;
}
Try to edit previous post and choose this category. It should fix the problems.
Edit: The second solution without changing admin.php is to delete the old category and try editing the temporary category info via category list to a title with Chinese characters, so use a slug with Latin characters.
Great, this code is works, hope to the next version to support different language processing. thanks.
In the latest version (3.0.9) I added an option to change this. Under config/metatag, Transliterate Slug option.
I will close this one. Thanks