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

scribu scribu at gmail.com
Thu Mar 26 00:28:42 GMT 2009


>
> Thank you for your reply, but this didn't solve problem. Or maybe you
> thought that this should be used with Alexander's hack?
>
>
> The idea is simple, you should only fix permalinks when
> > (post, category, tag, ...) slugs change.
> >
>
> Yes, that was my idea too but don't know how to solve it.
>
> 2009/3/23 scribu <scribu at gmail.com>
>
> > Maybe this will fix your problem:
> >
> > function sanitize_title_with_translit($title) {
> >       global $tr;
> >        $new_title = strtr($title,$tr);
> >
> >       return ($new_title == $title) ? $title : $new_title;
> > }
> >
> > I've simply added a check so that the slug isn't converted twice.
>

This is how a potential plugin should work:
Use the above function to go through all posts and convert the slugs. The
check I added would prevent slugs from being translated twice.

After that, the plugin would automatically translate slugs whenever new
posts are added. This would be done by setting the function as a filter on
'sanitize_title'.

-- 
http://scribu.net


More information about the wp-hackers mailing list