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

Is there a way to prevent WordPress from including special characters like – (long dash), ", ', etc.. from the post slugs?

Basically, I'd like to run the post-slug through a filter when it is created, and strip any special chars.

The reason is, that it's giving me problems as these show up as utf8-urlencoded in my rss feed, and those links don't work.

share|improve this question
allowed tags, etc. can be found in formatting.php – kaiser Dec 20 '11 at 23:38
up vote 1 down vote accepted

Found the answer I was looking for:


    // Cleans special characters out of the slug, if the slug hasn't been set yet
    add_filter('name_save_pre', 'clean_slugs', 0);

share|improve this answer
Just a reminder, when you are back, don't forget to mark this as your answer. :) – its_me Jul 17 '12 at 3:54

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.