In this knowledgebase article, we’ll walk you through what a slug is in WordPress.
What is a WordPress Slug?
In WordPress, the slug is the text that appears after your domain name in the URL of a specific page. For example, how-to-setup is the slug the following page:
By default, every single public page on your WordPress site, including posts, pages, categories, and author archives, has its own slug.
Every time you create a new post, WordPress automatically sets the slug based on your permalink settings but we do not recommend keeping the default settings as they are not user-friendly for both search engines as well as humans. You can go to WordPress Dashboard > Settings > Permalinks and change how slugs are generated.
Sometimes, as in the example above, you’ll actually have two slugs back-to-back. This is because the “kb” part of the URL represents the slug for our Knowledge Base section, and the “how-to-setup” part represents the slug for the specific post. With the help of the Rank Math plugin, you can easily set the slug for post/pages, category/tags, and author pages.
How to Set Slugs in WordPress
You can set the slug for a WordPress post/page whenever you’re creating or editing a post. If you’re writing a new post, please save it as a draft first. Click on the Title box, and you’ll see a box containing the Permalink URL with an Edit icon.
Once you click on Edit you can edit the slug as shown below:
Click on Save and then Publish or Update your post.
How to Change WordPress Category or Tag Slug
The process of setting a slug is identical for both categories and tags.
Go to Posts > Categories (for categories) or Posts >Tags (for tags). Then, look for the category or tag you want to edit, hover over it, and click the Edit button. Once done click on Update.
How to Change WordPress Author Slug
In order to change the Author slug please head over to Rank Math > Titles & Meta > Authors > Author Base and change the author base that was previously set.
If you’re changing settings on an existing website that’s already receiving traffic, we recommend proceeding with caution & looking into putting redirects in place.
What Happens When You Change the Slug After Publishing?
When you change the slug of a page after publishing/page that is already driving traffic, then your visitors/crawlers landing on the old URL will no longer be able to access the content. Instead, the browser will return a 404 error, which means that the requested page is not found.
To ensure that you don’t lose your potential traffic to your content while changing slugs, you should redirect the URLs with the old slug to the new ones. If you happen to change the slug of any traffic-driving pages, you can redirect your old URLs using Rank Math.
And, that’s it! We hope the article was helpful in understanding WordPress slugs. If you still have any questions, feel free to reach our support team, as we’re always here to help.