filtering special chars from post slug

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.

Read More

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.

Related posts

Leave a Reply

1 comment

  1. Found the answer I was looking for:

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