WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To keep legacy entries on a blog hosted on TypePad on sync with a new WordPress installation...

How do I map this permalink with accented letters:


to this clean WP permalink without accented letter:


What is the best way to accomplish this?

share|improve this question

migrated from stackoverflow.com Apr 28 '12 at 19:00

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

The best way to accomplish this is remove the default sanitize_title filter and replace it with yours, which will encode those characters properly. Here is an implementation of using accents in permalinks.


remove_filter( 'sanitize_title', 'sanitize_title_with_dashes');
add_filter( 'sanitize_title', 'restore_raw_title', 9, 3 );
function sweURLtoCHAR($text)

  $str = str_replace($char,$url,$text);
  $str_new = str_replace(" ", "", $str);
  return strtolower($str_new);
function restore_raw_title( $title, $raw_title, $context ) {
  if ( $context == 'save' )
   return sweURLtoCHAR($raw_title);
  else {
   $title_new = str_replace(" ", "", $title);
   return strtolower($title_new);

You can find the characters and their utf8 hex here and build an array with the accented characters you need.

share|improve this answer
Can you provide a code example here? – Brian Fegter Oct 21 '12 at 23:02
Just edited and added an example code :) – aWordpress Oct 21 '12 at 23:47
Why do you need to change out sanitize_title? According to codex.wordpress.org/Function_Reference/sanitize_title "and (in a 'save' context) accents are removed (accented characters are replaced with non-accented equivalents)". So, if you can simply run sanitize_title with save contwext you get the slug without accents. There is also a wordpress function remove_accents (codex.wordpress.org/Function_Reference/remove_accents) – Adam May 15 '13 at 12:03
Worked like a charm, but to make it work I changed sanitize_title_with_dashes with sanitize_title to write the url, not just the permalink slug. Thanks. – Juan Jul 20 '13 at 12:49

You could make a redirection with .htacces or perhaps try out the wordpress plugin redirection.

share|improve this answer
Thanks, but what would be the rewrite rule to be used on the .htaccess file? I'm redirecting thousands of posts. – Juan Apr 29 '12 at 12:59
No idea, i'm not an expert on the rewrite-rules myself. You could check out the docs of the apache manual. – Zombaya Apr 29 '12 at 23:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.