[wp-hackers] Helping international users by fixing this code

Alexander Concha alex at buayacorp.com
Fri Mar 20 16:56:59 GMT 2009


On Fri, Mar 20, 2009 at 5:38 PM, Milan Dinić <liste at srpski.biz> wrote:
> Hi everyone
> [...]
> If we install any of this plugins, all Cyrillic letters from titles of
> posts/pages/tags/categories are transliterated to Latin one in URL slugs for
> new posts/pages/tags/categories, but problem is that if there are already
> posts/pages/tags/categories with Cyrillic letters, those pages return 404
> errors. (just to note that if we turn off plugin everything works without
> problem)

If I didn't misunderstand your problem, you can do the same I did for
a plugin I wrote [1]:

With the following snippet you won't have the 404 problem because
sanitize_title_with_translit will be called only for the posts that
are saved.
function __enable_fix($post_name) {
	add_action('sanitize_title', 'sanitize_title_with_translit', 0);

	return $post_name;

add_filter('pre_post_name', '__enable_fix');

[1] http://www.buayacorp.com/archivos/nueva-version-del-plugin-permalink-fix/
Alexander Concha

More information about the wp-hackers mailing list