What Is A Slug in WordPress? (And Why It’s Important)

Today we’ll talk about slugs. No, not those slimy and gross kind of slugs. These slugs are actually an important part of WordPress websites.

Slugs are one of the lesser-known parts of WordPress website development. Yet it’s also a part of a website that you shouldn’t disregard. Mainly because it has a close connection with search engine optimization.

In this guide, we explore the different types of slugs in WordPress, how it affects your website development, and even give you a few tips on how to use them to your advantage. Keep reading.

One Subscription: Everything You Need to Build a Website

Get everything you need to build your next website with one simple subscription. From $16 per month, get unlimited access to nearly 2 million WordPress themes, web templates, fonts, graphics, and photos.

Build Your Next Website

What Is A URL Slug in WordPress?

A slug is a unique name or the identity you give to your blog posts and pages.

wordpress-slug-url-example

For example, when you create a new blog post, WordPress will automatically create a unique URL for the post based on its title. The identity or the name of this URL can be changed to your preference. This editable part of the URL is called the slug.

In a way, slugs are like the addresses to your website pages and blog posts. Each slug is unique and that’s what helps separate your pages from one other.

Difference Between Permalinks and Slugs

Permalinks (stands for Permanent Links) and slugs have a very close relationship. But, they serve two different purposes.

Permalinks are the default URL system that you use in WordPress. By going over to Settings >> Permalinks page, you can choose which URL structure to use on your website.

permalinks-vs-slug

No matter which Permalink structure you chose, you’ll always have a unique name at the end of each blog post and page you create to identify them individually. That unique name is called the slug.

When you change Permalinks settings, it affects your entire website. But, when you change a slug, it only affects a single page.

Note: Once you choose a permalink structure for your website, don’t change it. It will change all page URLs of your website and lose all search engine traffic coming to your website.

How It Affects Website SEO

When you search for something on Google, you’ll notice that all of the website links on the search results pages show the post slug of each and every page.

slug-in-google-serps

Google uses many different search algorithms and technologies to show the best results for each search. One of which is used to identify keywords used in webpages and URLs. And find pages with titles and URLs that closely match the user’s search term.

For example, if you search for “how to teach dog to roll over”, Google will search the web to find pages with similar titles and URLs.

This is why slugs are important for SEO. It helps your website rank better on search engines.

Different Types of Slugs Used in WordPress

In WordPress, slugs are used by several parts of the software to create unique URLs for each section.

  • Post Slugs: URL names for blog posts
  • Page Slugs: URL names for pages
  • Category Slugs: Unique URLs for category pages
  • Author Slugs: URL for author profiles

How to Set Post/Page Slugs in WordPress

As we’ve mentioned earlier, WordPress sets a slug for each page and post you create based on the title of the page. You can edit the slug to make it more flexible and convenient.

Before you set a slug for a post or page, first make sure it’s saved as a draft. Then follow the steps below.

set-slug-wordpress-gutenberg

In the new Gutenberg editor, the slug can be found under the Permalink tab in the Settings panel.

set-slug-wordpress-classic

On the classic editor, the slug can be found directly under the post or page title.

Simply edit and change the text in the slug. And save or publish the post.

You can also set custom slugs in categories and author profile pages.

category-slug

How to Edit a WordPress Slug

To edit the slugs of existing pages and posts all you have to do is, find the post you want to change and click on Edit. Then follow the same steps we’ve described earlier to change the slug.

Changing the slug of published pages is not recommended. Because it changes the URL of the page. If the page is already indexed on Google, people who click on the link will get a missing URL error since the URL has been changed.

If you have no choice but to change the slug, consider using a plugin like Redirection to redirect the traffic coming from the old URL to the new page URL.

4 Tips for Using Slugs in WordPress

Follow these tips when using slugs to make the most of them.

1. Write Short and Descriptive Slugs

The slug of a blog post or a page doesn’t have to describe the page title word for word. Instead, use a short slug that describes the page with key-phrases.

For example, if your post is titled “10 best and easy tricks to teach your dog” use a slug like “best-tricks-to-teach-dogs”.

2. Avoid Numbers and Capital Letters

Avoid using numbers and capital letters in slugs. Write the slug in simple (or small-caps) letters. This makes the URL easier to read.

Also, if you’re writing a top-ten style listicle post, avoid adding the list number in the slug. Just in case you want to add more items to the post at a later time.

3. Add Long-Tail Keywords

A good SEO practice is to insert keywords into the slug. This helps Google easily recognize your blog posts and pages based on search terms and keywords.

Consider targeting long-tail keywords in your slug.

4. How to Translate Slugs and Permalinks

You can also translate the slugs and permalinks of your WordPress website. It’s especially useful for multilingual websites.

Slugs can be translated using a plugin like Permalink Manager. However, you need to be using either WPML or Polylang plugin on your website for translations.

Conclusion

Even though it may seem insignificant and small, the slug can make a big impact on the growth and the effectiveness of a WordPress website.

Now that you have a better understanding of how slugs work, you’ll be able to take advantage of it to rank your website higher on Google and drive more traffic to your website.