New site owners often ask what is the post slug in WordPress and do I need it? This tutorial answers those questions and explores the best practices for your website.
What Are WordPress Post Slugs?
WordPress automatically creates the text that follows your domain name. That's your auto-generated post slug. However, these are not optimised for visitors or search results.
Here’s what a typical, auto-generated new post slug looks like with a WordPress site.
The end portion is not SEO-friendly, and it certainly doesn't make an easy read for your visitors.
You can do much better than that by controlling your post slugs. The way to that is from the permalink screen in your admin area.
Before we get to that, let's break a URL down so that it all makes perfect sense.
Create Descriptive Slugs in WordPress
Your URL or Uniform Resource Locator is an internet address—also called a web address.
A simple example of a web address is www.mysite.com/
And mysite.com is the domain name.
Anything that comes after your domain name is the post slug. Ideally, it's as short as possible and relates to the post or page. The way to do that is to make it keyword-rich.
We'll look at how to make keyword-rich post slugs shortly.
Why Slugs Matter
Have you ever lost an image file because you didn't name it correctly?
It's difficult to find if you can't remember what you saved it as. But if you gave it a descriptive name, well, it would be much easier to locate.
For example, an image file called Xmas-2020.jpg makes way more sense than img1123.jpg. The first example tells you what to expect when you open that file.
Think of a WordPress slug like a descriptive file name. But there's nothing descriptive when it looks like the example below. That's why you need to control them.
Your URLs show on the search engine results pages or SERPs. They also appear if you share links in newsletters or on social media.
If the URL is gobbledygook or irrelevant, the user may decide not to follow it. The example above is an excellent example of a slug that's confusing and off-putting.
And if it's readable but outdated, the user may still decide to ignore it, for example:
Don't include dates in slugs if you expect your posts to be timeless. The next example is better.
Now you have a clean URL with a post slug that's relative and descriptive. Clickbait like this arouses curiosity and encourages your target audience to follow it. Even though the post is a few years old, it may well be relevant today, and that's the point.
Post Slugs and Permalinks
There's often confusion between post slugs and permalinks.
Your permalink—aka permanent link—is the permanent URL for any post or page. It's your domain name + post slug. Ideally, it's a clean URL that's easy to remember and type.
And remember, the post slug is the part at the very end of the permalink.
So, in our example here, the slug content is /indian-adventures/.
You can customise your post slugs from your WP admin area.
First, let's open the WP editor to see the current permalink options.
Go to Post => All Posts.
Click on the Edit link to open any post in the Gutenberg editor.
Tip: Right-click on Edit and select Open link in new tab from the pop-up menu. Having two open tabs saves you from closing and reopening working windows.
We're now going to change that so you can edit your own slugs from within the editor.
Open the Dashboard tab, then Go to Settings => Permalinks from your side menu.
You're now at the Permalinks Settings screen.
Notice how WordPress displays five common structures for permalinks under Common Settings.
Plain is the default and SEO/visitor-unfriendly setting we looked at earlier.
There are 10 custom structure tags available. The least used and least valuable of these are hour, minute, second, and author name.
The %postname% is the post slug of your WP post.
Select the radio button next to the Post Name, then Save Changes.
Now return to your Guttenberg editor and press the F5 key to refresh the screen.
WordPress has replaced your plain permalink with the post name URL slug.
It automatically takes the post title and uses that, which makes a lot more sense. But you also have the option to change it manually if you want to.
If you do change it, remember to click Publish or Save Draft.
Now your post URLs are SEO and human-friendly.
Point to note: All the slugs for your posts and pages will now have new URLs using the titles. Obviously, it's better to choose the permalink settings before publishing a new web site or blog.
You can edit the permalinks for any post or page at any time in two ways. One is to open the post or page in the Gutenberg editor and change it as shown above.
Or, you can do a Quick Edit from the All Post or All Pages screen.
Go to Posts => All Posts from the Dashboard side menu.
Click the Quick Edit link under the post title to open the quick edit options.
You can now change the URL Slug from the Quick Edit screen.
There are lots of other quick edit options here too. You can change the title, author, categories, tags, and several other options.
Click Update when you're done to store the changes.
Remember, the words used in your post slug are important. They can help to influence your search engine rankings and visitor clicks. And if you want your post or page to be timeless, be sure to exclude dates and other things that may suggest it's an old or outdated post.