I’m using permalinks in WP as: domain.com/category/post_name
The issue is that post names have non-latin characters such as chinese, hebrew, and arabic. So it encodes them to something like: %20%18%6b%20
therefore it counts every symbol’s character as an actual character, ending up with 3x times more length that it truncates some very short slugs.
How to fix that? Or at least how to extend the length limit at least? I’ve tried to extend the length of the database field “post_name” from 200 to 500, But it’s still truncating short.
You can change
post_name
by appling the filters forsanitize_title
…Short example:
but, be careful… bad sanitizing can be security risk… sql injections etc…
WordPress should not be encoding your post slugs like that. I use utf8 characters in titles and slugs all the time for clients. It works fine.
Are you sure that your database table’s charset is utf8? If so, has it been overridden for any of the columns? Also check
wp-config.php
fordefine('DB_CHARSET', 'utf8');
I would also disable any plugins and test your permalinks again. Maybe one of your plugins is screwing with your post slugs.
This is a common situation that frustrates me too.
Check this plugin. Clean Trunks
(Default: 35 characters.)
Hope this will help. Cheers !!!
For non English URL:
I’m using IIS with fcgi and I found the solution for non english slug in different places on the web:
for Hebrew: here
for more info about IIS7 URL Rewrite and Symbols : here
generally except the IIS configuration for pretty url you need to add to the end of the wp-config.php:
here you will find more about UNENCODED_URL
Why not remove these bad characters when creating/saving the permalink?