I’m trying to make a blog script from scratch (PHP) and import posts from WordPress.
I need to use the exact same permalink algorithm as WordPress because I want to keep the URLs same. (and just in case I need to go back to WordPress)
The custom structure is /%postname%/.
I noticed that special characters (such as * – /) and unicode characters are ignored, and if it’s a duplicate, a number is automatically added at the end.
Is that all I need to know?
Thanks.
The WordPress function you need to look at is
sanitize_title_with_dashes
inwp-includes/formatting.php
.WordPress has defaults, but those defaults may change from version to version. Plus WordPress also lets you customize the permalinks, so I don’t think you’ll find a “universal” structure.
With that in mind though, here’s an article on URL Design that might be helpful.