Everything You Need to Know About the WordPress Slug
Let us talk about slugs. No, not every gardener’s least favorite invertebrate: WordPress slugs. A slug is a feature of all websites, including WordPress-ran ones, and an important attribute of posts, pages, categories and tags, among other things. Even if you are a novice user, there is no way you haven’t encountered them. However, even if you are a seasoned user, there may be things you are not aware of which still affect the functioning of your website. Slugs have effects which relate to SERP rankings and user experience.
But let’s start at the beginning: what is a WordPress slug, exactly? How can you set or change them? How do they affect your website? We will answer all of these questions, and more, in this article. Here’s what we’d like to talk to you about:
The slug is a part of a URL. It is located behind your domain name. The slug should not be confused with a permalink: the slug is only a part of a permalink – the last part. It is essentially a URL-friendly name for a post, page, category, or tag.
Still not clear on what it is? Here’s a slug example. This is from our article on the difference between JPG and JPEG:
Since every page must have a slug, it is only logical that WordPress generates slugs automatically. So, if that’s the case, why bother learning about slugs in the first place? The reason is, as usual, that you can make them work better for your website and its users.
When WordPress generates a slug automatically, it does so following user-defined settings. You can find these settings if you navigate to Settings/Permalinks from your WordPress dashboard.
One way of going around it is to use the Permalinks settings described in the section above. The settings there come in two groups: Common and Optional. All the Common options are pretty much self-explanatory: you can select which data to add to a number generated or use a post name as a basis for slug generation.
The Optional settings let you choose a base for tag and category pages: basically, to add a different “name” to your categories and tags.
All of the above is explained in great detail in the WordPress support article on using permalinks.
There is another way of generating slugs, though: you can do it yourself! To change the slug of a post or page, simply find said page or post on the Posts or Pages page and select Quick Edit.
The Slug field should be immediately below the Title field. Once you are happy with it, click the Update button.
You can change a category’s slug the same way you would change a category name. The settings you need can be accessed by navigating to Posts/Categories. Similarly, the requisite settings for tags can be found under Posts/Tags.
If you are running a website with multiple contributors, each of them may have their own slug. In order to give them one, though, you need to install a free plugin called Edit Author Slug. After having installed and activated the plugin, navigate to Users/All Users from your WordPress dashboard and select a user to edit.
On the user settings screen, you will find a new Edit Author Slug section, provided you are authorized to do so. There you can select which slug to use for the user edited.
Note that all slugs must follow certain rules:
-
only lower case letters may be used
-
dashes must be used instead of spaces
However, even if you do “break” these rules, WordPress will correct the slugs for you.
Now, your post or page must have a slug – it’s part of its URL, and URLs are mandatory and unique. So it can just be a long, nonsensical string of numbers, right? Right. But here’s why you should still do it: SEO.
If a post or page contains a keyword in its URL, it is likely to rank better on search results pages. You can even use your target keyword, but be careful: if multiple posts are supposed to rank for the same keyword, this may prove difficult.
Since a majority of modern internet users are far less likely to type in URLs nowadays, it matters much less if the URL is easy to remember, logical, relevant, or even legible. The users are far more likely to click on a link or scan a QR code in order to reach a website or a page that they need. Still, even if you disregard SEO, your users may appreciate knowing at a glance what the page is about – especially if they are prone to opening multiple tabs at once and then forgetting what they were supposed to be researching for, say, an article on WordPress slugs.
Be Careful About Stop Words
Stop words are words which search engines often ignore, both in search results and in queries. They are typically articles, prepositions, pronouns, and conjunctions – words such as a, an, the, yes, no, and, and more, in English, for instance. It will, of course, be different in other languages. From the point of view of the search engine, they do not change the meaning of a query.
Many SEO plugins will have the option to automatically remove stop words from slugs. And while this shortens the slug and makes it better for your users and for your SEO, it may actually turn out to be harmful if you are writing an article on, say, the melodic stylings of the British prog rock sensation Yes.
Use Redirects
If you change a slug, you will have changed the URL as well. If your own or some other website links to, for instance, a post you optimized a slug for, the link is now broken. Broken links are bad for your website in different ways, and detecting and fixing broken links is something you should be doing on a regular basis. However, if you yourself change a slug, you know you should also probably set up a 301 redirect.
Avoid Dates
Not only are dates rich in numbers and arguably a little more difficult to parse than words, recent articles are much more likely to attract attention from search engine users. Now, yours may be the case of pillar content or evergreen content, which stays relevant for a long time, but a user may not be aware of that and skip what would otherwise be a worthwhile read.
In Conclusion
As you can see, slugs are a somewhat important part of how users see your website, but a hugely important part of how search engines do. In this day and age, countless multitudes of internet users are spoiled for choice and bombarded with attention-grabbing content. If you want your content to reach them, you need to do all you can, and not knowing your way around a feature as important as a WordPress slug is not an option.