What is a Slug in WordPress?

What is a Slug in WordPress

‘Slug’ is a term used frequently in the field of web development, and chances are you’ve used or heard of it before. But what is a slug in WordPress? Simply put, WordPress slugs are descriptive, editable texts attached to the tail end of the URL to posts, pages, and other WP content.

Slugs identify and enable users to access particular resources in a WordPress site.

To illustrate this concept, here’s a screenshot of a post on our blog.

WordPress Slug

Now, the title of this blog post is “A step by step guide on how to reinstall WordPress”. If you look closely at the URL, the underlined part reads: “a-step-by-step-guide-on-how-to-reinstall-wordpress”. This underlined part is what is referred to as slugs in WordPress.

In this article, you will get to understand slugs some more. Additionally, you will learn how to set slugs, edit them, and optimize them.


What Are WordPress Slugs All About?

As earlier mentioned, a slug is the text after your domain name that identifies particular resources on your site. For example, in the URL – www.fixrunner.com/how-to-install-plugins, the slug is ‘how-to-install-plugins’ and this part of the URL helps you locate this particular post on the site.

By default, WordPress sets slugs for you, automatically, when you publish posts and pages. But you can always change it to your desired slug.

On the backend of WordPress, here’s how a slug looks like:

Slugs in WordPress

From the screenshot above, you can see WordPress automatically generates the slug when we create a new WordPress post. Changing the slug can be done by clicking the Edit button, and then clicking OK after making changes.

What is a Category Slug in WordPress?

In many cases, your content will be grouped into categories. And you may want to show slug for categories in your URL.

Let’s say you run an online store where you sell sneakers, bags, and wristwatches.

To make it easy for your customers to find whatever product they are looking for, you have to put all products into 3 separate categories. That is sneakers, bags, and wristwatch categories.

The category slug for, say, a bag will look something like this: https://mystore.com/bags/givenchy-bag-torquoise-leather. In this case, your category slug is /bag/ and your entire slug is /bags/givenchy-bag-torquoise-leather.

For a sneaker, the slug could be:

https://mystore.com/sneakers/nike-lebron-17. Similarly, your category slug is /sneakers/ and your entire slug is /sneakers/nike-lebron-17.

What Makes a Good WordPress Slug?

All slugs are not created equal. While some will be beneficial to your WordPress site, some others may be detrimental.

You should take the extra step to optimize slugs on your site. To do so, here are things you could do to set slugs effectively:

Keep it short

Shorter URLs are easier to read and understand. They also display better on search engine results on mobile devices. So keep it short.

Make it descriptive

Instead of using article number or the date the article was published as your slug, use the title of the post or page. Which is easier to read – www.fixrunner.com/2019-10/?p=123 or www.fixrunner.com/how-to-use-wordpress-plugins?

Intelligently include your focus keywords

Slugs are a great place to insert terms you would like to rank for on search engines.

However, you need to be smart about it. It can be tempting to stuff SEO keywords into a slug all in the bid to insert keywords, but doing so is counterintuitive.

It’s recommended you insert the most important word/phrase you’d like to rank for and cut the rest out.

For instance, if you wrote a post titled “How to write optimized WordPress slugs”, rather than stuffing in most of the letters, you could simply include WordPress slugs and leave the rest. An example would be:


As much as possible, avoid using stop words as keywords. They are extremely common words that search engines often ignore. Eg: “also”, “and”, “but” “did” etc.

Avoid making changes to slugs after publishing a WordPress post/page

You can very easily edit post slugs on a WordPress website. However, changing your slug would mean every link to the previous slug would break.

For instance, here’s a fictitious URL to a post on your website.

https://www.mywebsite.com/blog/slug. If you suddenly changed it to

https://www.mywebsite.com/blog/optimize-slug, a visitor that attempts using the previous link might encounter 404 error problems. This means the visitor will be told that the content s/he is looking for isn’t available, while it is.

So, it’s best to make all the changes to a slug before hitting the publish button.

How WordPress Slugs Affect SEO

One major benefit of slugs when it comes to WordPress SEO is that you can insert your focus keywords into slugs. Focus keywords are terms or phrases you wish to rank for on search pages.

Let’s say we wanted a post to rank for ‘wordpress-seo’ keyword. We would make the slug include those words, e.g. www.fixrunner.com/wordpress-seo-complete-guide.

A descriptive, keyword-focused URL helps search bots understand the content of your website, and hence rank it better.

Secondly, a readable URL structure is effective in capturing the attention of searchers who might be interested in reading your content.

Where to Set Slugs

There are five places in WordPress where you can set a slug, namely:

  • Pages slug
  • Posts slug
  • Category slug
  • Tag slug
  • Author slug

How to Set Slugs

In this section, we will show you how to set the five different types of slugs. As we earlier mentioned, WordPress automatically creates slugs when you create content. WP does this using your Permalink settings.

Permalink structure is a mold for your slugs. That is, your slug is formed according to what you specify in Permalinks.

Changing the permalink structure of your website is pretty straight forward. To do this, navigate to Settings >> Permalinks.


As you can see, there are a number of options, including Day and name, Numeric, etc.

We will save your time by telling you we highly recommend the Post name structure.

If this was not your permalink structure, you should ideally switch to it. Note though that you would need to set 301 redirects after making this change so your links do not break.

Permalink Structure

Side note: Earlier, we discussed category slugs such as /bags/bag-name. If you run a site that requires grouping in this way, then you should set your permalinks to include category slug.

To do this, select the Custom Structure. Clean out the content in the input box to the right. Then in “Available tags” click %category% and then click %postname%. Your structure should look like this:

Custom permalink

Go ahead and click Save.

With that taken care of, here’s how to set and edit the different types of slugs we had earlier mentioned.

What is a Slug in WordPress – Post Slug

To set a post slug, in your WordPress dashboard, simply navigate to Posts >> Add New.

Post slug

Type in the title of the content. At first, you might not see the post’s slug. To make it appear, click Save Draft.

After saving, the permalink would appear. Click the Edit button to change it.

Posts slugs

Use only words and dashes in your permalink. Remember to include keywords as needed. When done, click OK.

What is a Slug in WordPress – Page Slug

You set WordPress page slug just the same way you do for posts. Navigate to Pages>> Add New. Type in the title of the page and save the draft. The slug will appear. You can change it to your desired slug.

What is a Slug in WordPress – Category and Tag Slug

To add/edit category slug,  navigate to Posts >> Categories


Then set a name for the new category and enter the desired slug.

WordPress Category Slug

If you want to edit slug for an existing category, hover over it from the list on the right and click Edit. An edit page will open and you can make changes to the slug as needed.

Edit category

The process for adding/editing slug is similar to tags. Only this time navigate to Posts >> Tags

What is a Slug in WordPress – Author slug

To edit author slug in WordPress, you will have to tweak things a little bit. The reason is WordPress automatically generates a slug for an author via their username. But the username of an author can’t be changed once it’s been set.

If you would like to still forge ahead, you will need to install and activate a plugin called Edit Author Slug.

After installation and activation, navigate to Users >> All Users

Users- All Users

Pick the author you would like to edit his/her slug. Then beneath his/her username, click Edit

Users- Edit

On the next page, scroll down to the Author Slug section. In the Custom field box, enter your desired slug for the author.

Users- All Users

Scroll down and click Update Profile. Upon click, the plugin with automatically update the author’s slug to the new one you just chose.

Changing Your Slug

If your slugs aren’t good enough, you can change them. However, don’t forget to create redirect the old URL to the new URL. How do you go about this? Get a plugin designed for this purpose.

The redirection plugin is just one plugin you can use. It is free and amazingly easy to use.

Simply install and activate the plugin. Upon activation, go to Tools>>Redirection>>Start setup.

301 redirects

Enter the Source URL and the Target URL, and click Start Setup.

Next, check all appropriate boxes and click Continue Setup.

Redirection plugin

The plugin checks your website for at least one working REST API. If there is, it will display ‘Good’. Click Finish Setup to complete the redirection setup.

Setting up redirection

Finally, click Finished. Note that you have to repeat these steps for each URL you wish to redirect.

What is a Slug in WordPress – Conclusion

In this article, we shared with you what slugs are about. Added to that, you also got to learn why well-optimized slugs are important, and how to set them.

To fully understand WordPress slugs, you also need to understand Permalinks. You can read our WordPress Permalinks guide to learn more.

More Resources:

 This post was written by Sam Mulaim

Hello! I’m Sam - the founder and CEO of FixRunner WordPress support. When I started FixRunner one of my goals was to help people run a successful website and overcome WordPress issues. I don’t have much time these days to write new posts but when I do I enjoy it very much.

Last edited by: FixRunner Team