Is there a page somewhere that details exactly how WordPress generates slugs for URLs? I'm writing a script that needs to generate URL slugs identical to the ones WordPress generates.
Off the bat, I can't give you a page/tutorial/documentation on how WP slugs are generated, but take a look at the
Don't get a wrong impression by the function name, it is not meant to sanitize a title for further usage as a page/post title. It takes a title string and returns it to be used in a URL:
There might be edge cases where the core does something additional (you'd have to look at the source to verify that
Core at your service
There's no developer mode built into WordPress aside from
Plugins that help looking into it.
Toschos "T5 Rewrite"-Plugin and Jan Fabrys "Monkeyman Rewrite Analyzer"-Plugin will guide you your way. I've written a small extension for "T5 Rewrite" to smoothly integrate it with the "Monkeyman Rewrite Analyzer", which you can find in the "T5 Rewrite" repos wikie here on GitHub.
The "Monkeyman"-plugin adds a new page, filed in the admin UI menu under Tools. The "T5 Rewrite"-plugin adds a new help tab to the Settings > Permalinks page. My extension adds the help tabs to the mentioned Tools-page too.
Here's a screenshot of what the "T5 Rewrite"-plugins help tab content looks like.
Vorlage = Pattern | Beschreibung = Explanation | Beispiele = Examples
The "T5 Rewrite"-plugin does a wonderful job with helping you inspect the rewrite object. And it does even more: It adds new possibilities. Therefore it's (at least in my installations) part of my basic plugins package.
You can use this function:
Its kind of exactly how the wp url sanitize function works.