If you’ve used WordPress or heard about it, you must’ve also heard the term slug being mentioned. Obviously, it doesn’t represent a slimy creature in nature. Instead, we’re talking about a key part of Internet links, blogging, and SEO (Search Engine Optimization). As such, knowing and understanding it allows you to optimize it. After all, an unoptimized slug can give off a sense of not being well-versed enough. It can also be disastrous if the same slug is used for 2 different articles. With its importance hinted at, let’s define slugs by answering the question – what is a slug in WordPress?
What’s a WordPress slug?
A slug in WordPress is a portion of an URL that helps both visitors and bots/crawlers identify a particular page on a website. As such, a slug should provide the shortest user-friendly, clear definition of what the page’s content is. To clarify that point, take our website as an example. In the entire URL, https://wpthinker.com/wordpress-slug, the bolded part represents the slug.
Difference between slug and permalink
We already explained the example above, where the slug is only the “wordpress-slug” part of it. Of course, not all websites look like that. If there are other variables in the URL, the slug can be harder to identify. Let’s look at these 3 permalink structures, for example:
- https://wpthinker.com/2021/02/17/wordpress-slug
- https://wpthinker.com/category-name/wordpress-slug
- https://wpthinker.com/wordpress-slug/1571
So, how do I distinguish slugs in the URL?
As you can see, if your permalink settings aren’t set to Plain or Post Name, you can easily get confused. That’s because a slug can also be an ID, date, parameter, or a set of numbers. Additionally, slugs can also be combined. In the first example, a date slug was combined with a post or page slug. In the second example, a category slug was combined with a post/page slug. Finally, the third entry demonstrates a way to have two articles use the same page/post slug without negative consequences. This is useful for multiple authors who have different takes on the same topic.
Can you change a slug in WordPress?
Yes. Here’s a guide to change a slug in WordPress. WordPress generates a slug based on the permalink structure, which is most often a page or post name. The optimal time to change a slug in WordPress is before a post or page is published. It can still be done without repercussion shortly afterward – before the page is indexed.
Should I change the slug in public WordPress pages?
If some time has passed since it was published, never change it unless necessary. We know that’s hard, especially if you want to change your permalink settings or come up with a better-suited slug. However, changing a slug after publishing can hurt your SEO, cause an article to be marked as a duplicate, and be marked as a broken link. You can fix that, of course. Check method 7 in our “how to find and fix broken links” guide. Just know that it will be time-consuming and can hog your website resources.
How to optimize a slug in WordPress
Here are 6 optimization tips for slugs in WordPress:
1. Use lowercase letters only
Don’t worry, WordPress will automatically convert uppercase characters to lowercase ones. This is because, in the past, website owners could accidentally publish two articles using the same slug. It happened when one or more capital letters in one of the articles weren’t detected by the CMS (Content Management System) and you made a slug copy. Even though the content was different, the articles were marked as duplicates by search engines.
2. Add dashes instead of spaces
Once again, WordPress will correct it for you, but it’s nice to know why they do it.
3. Stick to the English alphabet
Of course, we’re only talking about international websites. If your language uses a variation of the English alphabet, you can choose to use the closest letters in the slug and the text. For example, c instead of č, ć or z instead of ž. Otherwise, use special characters everywhere. Also, characters such as <, >, {, }, |, “`, ^, \, (, ), [, ] are forbidden. If you see websites using them, this was because they were allowed once upon a time. As mentioned, it would ruin their SEO if WordPress forced them.
4. Make it short but descriptive
Shorten the slug to the version of the title that still makes sense to readers. If things make sense without them, feel free to remove words such as “a”, “an”, “and”, “the”, “in”, “on”, “from” etc. As mentioned, such a slug also helps bots and crawlers understand the topic easier and boost your position in the search results.
5. Refrain from using dates or numbers
Take our 10 best WordPress plugins for eCommerce article as an example. Although the number is in the title, it isn’t in the slug. That allows us to add more entries down the line, and we only have to update the title accordingly. If the number was in the slug, we’d be stuck on the original number. The same goes for things such as dates. Take “best eCommerce WordPress plugins in 2021” as an example. You might want to update content yearly without losing your rating, and it’d be impossible if you specified a year in the slug.
6. Use an SEO plugin
It’s never too early or too late to start using WordPress plugins and tools for SEO. They are equally suitable for starting and maintaining a website with killer traffic.