A Straight-Forward Guide To WordPress Slugs
When using WordPress there are so many things one might choose to learn and master that some of the most basic elements of your site can be overlooked. Especially the parts that are a bit dry and not the least bit glamorous.
Like this post’s topic: The Slug.
What is a Slug?
A WordPress slug is nothing more than a few words, which you choose, to describe a post, page, category, or tag within WordPress. These words then appear as part of the URL (or Permalink) directing visitors to that content.
The title of this post is: A Straight-Forward Guide to WordPress Slugs
The automatically generated slug for this post was: http://marketingsolutionshhi.com/straight-forward-guide-to-wordpress-slugs/
As you can see, the concept is extremely simple. But its implications are also extremely important as you will see in the section on optimization below.
Where Do Slugs Appear in WordPress?
Before we get into optimization, lets take a moment to identify all of the places within the WordPress admin where slugs are created; there are four.
Posts & Pages
The first two places are probably the most obvious: posts and pages. As you just saw in my example above, WordPress automatically generates a slug for every post or page you create based on the title you write in the title box.
You are then able to edit and save the version that you prefer before publishing. Which, by the time you’re done with it, may be altogether different than the post or page title. Something we’ll get into in more detail in the optimizing section below.
Categories & Tags
The final two places within the WordPress admin where you can create slugs are the Categories and Tags submenu pages.
In both cases the form looks the same. You type the name of your category or tag in and then enter your preferred slug beneath it. The slugs has to be lowercase and with dashes instead of spaces.
Now that we know where to go to create slugs, let’s talk about how to get the most out of them.
Tips for Optimizing your WordPress Slugs
Like most things with WordPress, there are usually many ways to accomplish a given task all at varying degrees of efficiency and effectiveness. Or in simpler terms: doing something isn’t the same as doing it right. Or best.
With that in mind, we’re going to drill down into some best practices for creating slugs–one of the simplest things one can do in WordPress. But also one of the most important things to do right.
The decisions you make when creating a slug are likely to appear in every single link you generate. So for obvious reasons of search engine optimization, page structure, etc. Let’s take a look at five simple guidelines for creating WordPress slugs.
Note: in this post I am intentionally focusing on just slugs and not the full permalink. For more information on WordPress permalinks and associated best practices, see our post A Guide to WordPress Permalinks, And Why You Should Never Use the Default Settings.
Keep Them Simple
In every instance, the slug you create is an addition to an existing permalink or permalink structure. Depending on what you choose in your permalink settings, your average url could include your site name, date, category, post/page name, and even more if you choose.
So unless you want a jumbled mess that’s hard to follow structurally and even difficult for Google and other search engines to read, keeping each element as simple as possible. Probably the best way to accomplish this is using as few and as specific words as possible.
Make Them Relevant
To me, this seems like a massive no-brainer–but it needs to be said. In an effort to simplify and shorten your slugs don’t sacrifice relevancy. Don’t cut out the words that actually describe your content best.
Speaking of which…
Target SEO Keywords
Within the confines of your simplified slug of limited words, make those words count. Target the SEO keywords that best describe your content and that you are trying to rank for.
Avoid Duplicates by Emptying the Trash
Every create a post or page and have the number “2” attached to the end of it? That’s happening because you have another post or page with the same slug and WordPress can’t let that happen. So it slaps an ugly “2” on there.
To fix this, either change your slug to something slightly different (in the case of closely related blog posts, for instance) or find the unpublished (perhaps even deleted) post and change or delete the offending slug.
If the post is already deleted, it’ll appear in the page/post trash archive. To get rid of those posts simply select all with the bulk editor and “empty your trash” by choosing the delete permanently action.
Don’t Change Them After You’ve Published Them (Unless You Absolutely Have to)
And finally, once you’ve published a link–don’t change its slug. This will alter your url, meaning any link existing on the web to that location will now be broken. Resulting in lost traffic.
However, if you absolutely must (and I suppose if your slugs are a total mess you probably should) alter your post slugs, there is a right way to go about changing them so that you don’t lose any traffic.
(It’s just a bit of a pain compared to setting things up right the first time.)
What to Do if Your WordPress Slugs Are a Mess
For those of you who may have really messed up your slugs and permalinks with clutter that is only going to hurt your content rankings in the long run, it may actually be a good idea to change your slugs so that they line up with the best practices described above. To do this, you’re going to need to either edit your .htaccess file OR use one of the following plugins. (I recommend going the plugin route.)
- Quick Page/Post Redirect Plugin
- Simple 301 Redirects
All three of these plugins are solid options. My personal recommendation is the first one, Redirection. They are all rated highly in the plugin repository but this one has stood the trial of a truly massive user-base (over two million) and maintains a rating of four out of five stars.
It’s also really easy to use.
Here’s what you do. Install Redirection (or the plugin of your choosing) and then navigate to its settings page. On that page you will find a tool like the one below in which you are able to paste in a source link (i.e. the link on your site you would like to redirect) and the target for that link’s redirection.
You’ll need to do this for each link that needs changed. This assures that anyone clicking through to your site from an old link will not be missed traffic. Instead they will be redirected to your new link. The link that has a better structure and is also more easily located by both people and search engines.
Also, with the Redirection plugin you are able to view a log of all 404 errors on your site. Once you know which urls those errors are occurring on you can quickly make that link a 301 redirect and recapture that traffic too.
Mastering the humble WordPress slug can result in some pretty great things. More organic traffic for one. But also recaptured traffic if you go ahead and take advantage of a plugin like Redirection. The best part is that this is something that anyone using WordPress can wrap their head around and get right every time. It’s a good feeling!