Last updated December 14th, 2012 at 12:43 am
When posting a blog article or page to your WordPress Web site, WordPress will automatically generate a "sanitized" slug which is the defining element of the post in its URL. Unless you manually edit that slug (which can be done in two ways, described below), the default slug will be the title of your post, with all letters changed to lowercase and all spaces and other special characters (commas, slashes, etc.) converted to hyphens or removed.
So, if your blog title is "Piano Lessons" and your Web site is "http://myblog.com", the URL to that page will look something like:
If your blog title is "Holiday Bazaar", the URL will look something like this:
So, suppose you’re publishing a blog article about the lesson your learned about putting your online banking username and password on a sticky note attached to your computer monitor at work.
You might get creative and entitle your post, "Here’s something really, really stupid I did recently which I recommend you never do" Not a bad title, actually. If I saw title that in my newsreader (or Facebook newsfeed or Twitter timeline, etc.), I might be inclined to click and read.
So that’s the good news.
The bad news is that the URL for your post will be:
Why is that bad?
- Broken Link Syndrome: That URL is so long that if you were to email it to a friend, there’s a chance your friend’s email program would break the link, preventing your friend from getting to the article.
- No key words: A Web page’s URL is one of it’s critical search engine optimization elements.
What’s a better URL?
You get the idea.
How to edit your slugs
Note: In each of the methods described below, the new slug you enter will be sanitized (letters lowercased, spaces replaced with hyphens, special characters removed) after you do the Update.
Edit the slug right under the post title in the Edit Post page. Just click the Edit button and enter your new slug. (Click small images to enlarge.)
If your screen options for Edit Post are set to display the slug section, find it somewhere on the screen and enter the new slug.
Method #3: Quick-Edit from the All Posts listing
Hover your mouse over the title of the post whose slug you want to change, and a little menu will appear under the title. Click on "Quick Edit" link.
This will expose a whole bunch of settings you can change without actually loading the Edit Post page. Type your new slug in the Slug box, and click Update. (Click image to enlarge.)
Postscript: Changing Slugs Retroactively
You might be wondering…
Can I and should I go back and change some of my longer post slugs after the pages or posts have been published?
That’s a good question.
The answer is "probably yes". But here are a few things to consider before you change the slug of any post:
- Losing people.
If you emailed the original link to people, or posted it on Facebook — or anywhere else, for that matter — people who click on the original link will end up on your site’s Not Found page. This also applies if the original link of the page in question has been listed by search engines.
- Losing some search engine mojo.
If the original link of the page or post in question has already been indexed by search engines, it’s only a matter of time before those engines remove the link (which is, in a way, a good thing, since it’s a "bad" link). But until the search engines index the new link, you’ve lost a place in the search engine results. (Having people go to your Not Found page at least gets them to your Web site.)
- Internal links.
If you’ve manually linked to the page or post in question within the body of other pages or posts on your Web site, those internal hyperlinks will no longer be valid. (Small print: Unfortunately, WordPress’ native linking tool in the Edit screen hard-codes the URLs when you create hyperlinks. Some day, WordPress will probably fix that and use the IDs of posts in their linking tool, thus avoiding the broken link problem.)
If you have questions or comments, please post them below.
Chad R. Allen says
Helpful post, Jeff. Thank you! I especially appreciated your comments about whether or not to go back and change a slug after a post has been published.
Jeff Cohan says
Glad you found it helpful, Chad.
Suna Ram says
Well done for this helpful article. Can you please suggest me the perfect slug of the title. I mean to say that what should be there in slug section ? Can we replace default slug by keywords ? Can we remove few words from default slug for this ?
So, please help me !!!
waiting for your suggestion Admin.
Jeff Cohan says
I like to keep slugs short. I like them to include keywords. I almost always edit the default slugs and remove unnecesary words. For this particular blog entry, for example, I removed the word “your”, which appears in the title but which isn’t needed in the slug (IMO).
Suna Ram says
Thanks a lot !
I got my answer & its working good..
Very helpful Jeff, thank you. I try to make simple and easy to understand post so I am happy to see someone do a much better job.
I hope to start adding screen shots too, it only get’s better.
Had query about this slug shortening which has always been pointed up by my SEO analysis page. But got my query resolved after seeing your this post. Thank you so much!
Jeff Cohan says
I’m glad it helped.
Thanks so much, great info on slug role. Always wondered what it was useful for *smile*. Nice easy, well written explanation Jeff.