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.

  • allowed tags, etc. can be found in formatting.php – kaiser Dec 20 '11 at 23:38

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);

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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