A WordPress slug is the bit of text that comes after your domain name in the URL of a WordPress page. It’s the part of the URL that identifies each page on your site, except for the home.
As displayed in the above image, you will sometimes see that a URL can have more than one slug. The blog part of the URL represents the slug for our blog, the email part represents the category of our post, and the what-is-email-hosting part is the slug for our specific post.
All public pages including posts, categories, and author archives on your WordPress site have a specific slug. You can manage and control every single one of them. Slugs are very important for SEO and usability, so you should definitely pay attention to them.
What should go in a WordPress slug?
Since slugs are a part of your WordPress pages’ URLs, you need to apply some basic best practices when editing them:
- Don’t leave spaces, use dashes instead
- Only use lowercase letters
If you mistakenly forget these best practices, don’t worry, as WordPress will correct them by default.
Setting up post slugs in WordPress
When you are creating or editing your post, you can set your URL slug. Under the Title box, there is a Permalink URL with the Edit button:
By clicking on Edit, the slug portion of the URL will become available for editing.
Click Ok when you’re finished and don’t forget to Update or Publish your post to save your changes. Keep in mind that Google prefers well-structured WordPress sites, including short URLs and slugs. This will help improve your CTR.
Some studies have shown that executives are 250% more inclined to click on an organic listing that has a short slug, especially if it appears directly under a listing with a long slug. Using short slugs can give you an important advantage. In addition, keep in mind that by default, WordPress creates a slug for your post based on the title, no matter how long it is.
Setting up page slugs in WordPress
You can also edit a WordPress page slug with the Permalink URL that appears under your Page’s title. Click on Edit, then Ok after you finish. Remember to Publish or Update the post.
Changing a WordPress category or tag alug
After you create a new category or tag, WordPress will automatically assign it a slug. However, you’re able to change the slug if you prefer. The same process goes for categories and tags:
Click on Posts from your left menu and then choose between Categories or Tags.
Look for the category or the tag that you need to change. By hovering over it, you will see some editing options. Click on Edit.
The editing page will open, and there you will be able to edit the name, slug, and description of your tag or category. Type your new slug and then click on Update at the bottom of the page.
You can also use the Quick Edit option from the Category or Tag list. Don’t forget to click on Update Tag/Category to save your changes.
Changing the WordPress author slug
The author slug for an author’s archive page is their username, and WordPress doesn’t allow changes to it after it’s been created. However, you can use a free plugin to edit the author slug. After activating the plugin, a new Edit Author Slug box will appear on all users’ profile pages.
What happens if you change the WordPress slugs at a later late?
Changing the slug after you have published your content can be dangerous. If anyone tries to access your content with the previous slug, they may experience problems.
By default, WordPress will try to redirect users to a new post or page slug, and even though this usually works, sometimes, it may not. In that case, you will have to set up a redirect to the new URL, otherwise, your visitors will end up on a 404 page.
Also, for SEO purposes, you will want to use a 301 redirect to retain any link juice that the slug has built up. You can easily use a free WordPress plugin, like Safe Redirect Manager or Redirection, to implement a 301 redirect.
For categories or tags, on the other hand, WordPress will not redirect to the new slugs. Therefore, always try to avoid changing slugs after publishing content.
The relation between permalinks and slugs
A permalink will help you set the entire URL structure for your site. It tells WordPress where to put every slug you’ve created. You can access your permalink settings in Settings > Permalinks.
WordPress will attach your slug accordingly to the permalink structure you choose:
For example, if you choose the Day and name structure, WordPress will add the publishing date of your post before the post slug.
The most practical structure is Post name. Here, WordPress will replace %postname% with your post’s slug. With this configuration, only the slugs that you set will appear on your URL after your domain name:
Just like with individual WordPress slugs, be careful when changing your permalink structure if your site has already been published.
If you need help with your HostPapa account, please open a support ticket from your dashboard.