What is a Tag Slug in WordPress?
In WordPress, there are two words used to talk about the URL of a page: “Permalink” and “Slug”.
Let’s show the meaning of those words with an example:
- URL: www.example.com/blog/category/hello-world/
- Permalink: /blog/my-category/hello-world/
- Post Slug: /hello-world/
- Category Slug: /my-category/
When you create a post, category, tag, or other content, WordPress will automatically create a slug from its name. The slug is a URL-friendly and unique version of the name. Spaces are replaced by hyphens (“-“) and the slug is changed to lower-case.
Here at TaxoPress we deal with tags and categories, so we’ll do a deep dive on Tag Slugs.
What is a Tag Slug?
When you create a WordPress tag, you’ll see a “Slug” box. Here is the explanation provided by WordPress: “The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.”
Let’s use the example of a term called “My Tag”. This will automatically receive the slug when it’s created:
Additionally, WordPress makes sure that each slug is unique. So if there is already another term with the slug “first-tag”, WordPress may add a number:
Slugs are only created automatically when the tag is new. If you edit the name of an existing tag, you can delete the slug and then WordPress creates a new slug for you when you save the tag.
Where do Tag Slugs appear?
Tag slugs will most commonly appear on tag archive pages, where all posts are listed that use this tag. Your visitors, however, won’t usually notice the slug in the URL. They will see the tag name on the pages and in the page header.
You can edit a slug but WordPress will again make sure that it is URL-friendly and unique. When changing a slug, some links to the tag archive page might break and need to be updated as well. But usually there is no need to change a slug, even if you decide to change the tag name.
Slugs in WordPress
We’ve said that a slug is URL-friendly version of a post, page, or other content’s title. It is a part of the URL that identifies and represents a specific piece of content. A slug is always automatically generated when content is created, using the title of the content. For example, this screenshot shows a “Slug” field for a WordPress post:
In this next screenshot, you can see a slug example on the “Categories” screen.
If you’re the kind of person who’s interested in what a slug is, you may also be interested in finding out about what characters are allows in slugs, or how WordPress post IDs work.