See those crazy characters in the title of this post? Now see how they don't appear in the post's URL? That's one of the finer details of the WordPress 3.3 update: smarter permalink slugs.
So when you type something like you see in the title of this post, with all the funky characters, or even just something like a comma, apostrophe, or semi-colon, WordPress 3.3+ works the magic and automatically creates your post slug without the junk.
It may not seem like a big deal, but previous versions of WordPress would include those funky characters when auto-creating your permalink slugs. If you glance at URLs while surfing around WordPress-powered sites, keep an eye on the URL in the address bar. It's common to see all sorts of non-alphanumeric stuff in there.
Does it matter? I think so, for numerous reasons:
- Readability, consistency – simple alphanumeric URLs work great everywhere, no need to clutter them up with redundant information. For example, funky characters can choke URL-shortening services. Also: fewer characters, facilitates better comprehension.
- Safer – certain characters such as
}, and the blank space are considered as unsafe and should not be included in the URI (ie., always need encoded). Including them may seem to work, but you're introducing sort of unknown variable into the mix, a potential vulnerability*
- SEO — do funky characters like blank spaces and percentage signs in the URL hurt your site's SEO? Maybe not, but why put anything in there that isn't a keyword?
So smarter auto-slugs in WordPress 3.3, another one of the finer details that improves the overall WP post-editing experience, and something you may not have noticed.
Another sort of related “smarter-slugs” feature noticed while looking into it, is the automatic removal of the “-2” that WordPress automatically appends to the post slug when a duplicate is detected. So for example, say you're working on a new post:
- Create a post with a slug such as “
- Delete the post and send to the Trash
- Create another post with the same “
- WordPress detects the duplicate post in the database and appends a “-2”, like so:
test-post-2to the post slug
- Create yet another post with the same slug and WordPress will append a “-3”, and so on..
Nobody likes the “dash-twos” but they are required for the auto-creation of non-duplicate post slugs. What I just noticed with version 3.3 is that, once you empty the Trash, WordPress automagically removes the “-2” from the post slug, improving workflow to save you time. This may have changed in a previous version and I just hadn't noticed, or it's another one of the administrative refinements of WordPress 3.3.
Update: it looks like the -2 removal only applies to drafts and pending posts, not to posts that have already been published.. (see comment from Otto)
* More info on forbidden characters and blocking them