By default, wordpress remove accents and weird characters to generate post_name
in wp_posts table. This post_name is used when we change the permalink structure to /%postname%/
or some similar structures. In my language, i don't want to remove and replace many characters as it distorts the meaning.
I have change the sanitize_title_with_dashes
function in wp-includes/formatting to:
function sanitize_title_with_dashes($title) {
$title = strip_tags($title);`
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title);
// Restore octets.
$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
/* comment out this code block
if (seems_utf8($title)) {
if (function_exists('mb_strtolower')) {
$title = mb_strtolower($title, 'UTF-8');
}
$title = utf8_uri_encode($title, 200);
}
$title = strtolower($title);
*/
$title = preg_replace('/&.+?;/', '', $title); // kill entities
$title = str_replace('.', '-', $title);
// comment out $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
$title = preg_replace('/\s+/', '-', $title);
$title = preg_replace('|-+|', '-', $title);
$title = trim($title, '-');
return $title;
}
The post_name is correctly generated for all characters in my language, for example http://1.todaytravels.info
in the latest post, the url is very good, but wordpress simply does not find the post (it says not found
). I guess i need to change something in permalink structure so that WP query to the correct post.
Anyone know how to resolve this problem?
Thanks for any help!