In WordPress, the “slug” refers to the part of a web page’s address that appears after the domain name. A simple WordPress slug example would be if you visited a blog post at www.example.com/blog-post, then “www.example.com” is the domain name, and “blog-post” is the post slug.
By default, the slug of any post you publish will be the same as the title, only lowercase and with dashes instead of spaces. For example, if you start a blog and write a post called “My First Blog Post”, then the default post slug would be “my-first-blog-post”.
You can easily change the slug before you publish, or even to customize the default slug after you publish a page.
Why would you want to customize your post slug? Well, slugs help to identify a page on a website in a user-friendly way. They can help visitors and search engines determine a page’s content. Customizing your slugs can help improve your site’s SEO rankings and create a better user experience for visitors.
What is a WordPress Slug Used For?
The purpose of a WordPress slug is to create user-friendly URLs that help readers and search engines know what your content is all about.
Think of it like naming a file on your own computer. When you see a file called “2020-family-photo.jpg”, you know what to expect when you open it. That makes it much easier than a name like “IMG3256.jpg”.
Editing slugs is useful when a post title is very long, or if you’re going to be updating the content a lot. For example, you don’t want to use the slug “july-2020-deals” if you’ll be updating that post with new deals every month.
People can see the URL of your posts on search results pages or if the link is shared with them in emails, social media, or other places. For example, here’s the slug for our how to start a WordPress blog guide:
People may decide whether or not to click the link based on your slug. Optimizing your slugs helps to provide transparency and tells visitors what to expect when they click on a link.
WordPress slugs also help Google to understand what your post is about, and can help your posts rank better for the right keywords in search results.
WordPress Slug vs. Permalink: What’s the Difference?
Permalinks in WordPress are the permanent URLs of posts and pages on your website. For example, the permalink of this page you’re reading right now is https://www.wpbeginner.com/glossary/post-slug/.
The slug is the last part of the permalink.
For this page, the slug would be “post-slug”.
How to Change a Slug in WordPress
By default, your post slug will be determined by your post title. Any spaces will be replaced by hyphens, and the post slug will always be lowercase.
You can customize the default slug by going to Settings » Permalinks on your WordPress admin sidebar.
In WordPress, you also can edit the slug of an individual post or page while editing it. When creating a new post, you’ll see the permalink after you enter a title for your post and click the Save Draft link at the top of the page.
After saving the draft, you can edit your slug by clicking on the post title and then click Edit at the end of the permalink.
Next, enter your custom slug in the space at the end of the URL and click the Save button.
A post slug can also be changed by going to your admin sidebar and clicking on Posts » All Posts.
Just place your mouse over the post you want to edit. Then click on the Quick Edit button just below a post.
This opens the quick editor where you can change the post slug and other options. After you make the changes to your slug, click Update and that’s it!
How to Change Category and Tag Slugs
WordPress automatically generates a slug for your categories and tags, but you can create your own slug. To change a category slug, go to the admin sidebar and select Posts » Categories.
Select the category slug you want to change and click the Edit button. Now, type in your new slug and click Update to save the change, just like we did with the post slug above.
To change your WordPress tags, go to your admin sidebar and click on Posts » Tags. From there, you can follow the same process we did for categories.
How to Change the Author Slug
If you have more than one contributor on your WordPress website, then you can create a customized slug for each author. WordPress does not allow you to edit the author slug by default.
If you need to change the author slug in WordPress, then you’ll need to use a plugin. You can follow our guide on how to change the author URL slug in WordPress for more details.
How to Write an SEO Friendly Slug
The URL of a web page is one of the factors that search engines look at when trying to understand the content of a page, and how to rank it in search results.
If you want to rank your website content higher in search results and get more traffic, then you should consider writing SEO friendly slugs whenever you publish a new post.
Here are a few SEO tips to keep in mind when publishing a new post or page:
Avoid using dates in your slug. This helps to keep your post from looking outdated on your website, in search results, and in other places.
Decide on your slug before you publish. You may want to change a slug after you have published a post, but this will also change the URL. Remember, these are permalinks (permanent links) to specific posts.
If you do change a slug, then your visitors and search engines won’t be able to find your content if they go to the old permalink. To fix that, we recommend setting up redirects to your posts URL using a redirection plugin.
Keep your slugs short and descriptive. Be sure to include the main keyword you want to rank for in the slug. Use words that help describe the content your post.
Pro tip: Use AIOSEO – All in One WordPress SEO plugin to further optimize your website to rank higher.
We hope this article helped you learn all about post slugs in WordPress and how they work! Check out the additional reading below to learn more.