What is Slug in WordPress?

All about the WordPress slugs, you should know to optimize your URL
Last Updated:June 24, 2021

In this article, you can find the answer to the “What is a slug in WordPress?”. Furthermore, you can learn how to optimize slug following SEO best practices.

Table of content

Anatomy of a URL

Before going into the WordPress slug you can get an idea of the parts of the URL.

Understand the parts of a URL
Parts of a URL

Scheme

Scheme is the protocol that the web server is going to use. This can be either http or https (secure)

Subdomain

Subdomain can help you divide your website into logical parts

Second Level Domain

Your second-level domain (SLD) is the name of your domain and your website can be uniquely identified with top level domain

Top Level Domain

The top-level domain (TLD) specifies what type of entity your organization registers as on the internet

Directory

This can represent directory in your web server but in WordPress site you can represent taxonomy

Slug

Slug can be used to uniquely identify your page or post. You can learn more details about the slug in this article

What is a slug in WordPress?

Slug is a part of the URL which can be used to uniquely identify a post or page in your WordPress website.

Now, what is the slug of this URL "https://www.techiecontent.com/what-is-slug" ?. The answer is “what-is-slug” and slug is the name of your post.

What is the difference between Slug and Permalink?

The web address or URL (Uniform Resource Location) specifies the location of resources on the internet. In our context, the resource is the web page on your WordPress site.

Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives

Slug is a part of the URL which can be used to uniquely identify a post or page in your WordPress site. Slug has a unique value for each page or post and you can use whatever text values.

You can use slug to give URL-friendly names for posts, pages, tags and category.

In this post, I have used the slug as “wp-seo-101” and permalink is “techiecontent.com/wp-seo-1010/”

Please remember that the slug in a WordPress site is very important when it comes to SEO and people use simple relevant names so that you can remember the URL easily.

Why Slug is important?

In WordPress, you use the slug to create a permalink to the posts, pages, tags, and categories. Slug plays an important role in the on-page SEO of the web page because the name of the slug can be changed manually according to your SEO strategy.

Now we will find the answer to the question, How to optimize slug in WordPress? Because creating the correct slug is important when you do the on-page optimization.

Role of the Slug in WordPress SEO

Slug in WP plays an important role in SEO and we will study it in detail here now. 

Creating a better slug for your page affects the on-page SEO score of your page. With the correct slug, you can achieve several benefits. 

Include your target keyword in the URL

You can see what John Muller talked about the target keyword in the URL.

I believe that is a very small ranking factor. So it is not something I’d really try to force. And it is not something I’d say it is even worth your effort to restructure your site just so you can get keywords in your URL.”
John Mueller Google 2016

Although keywords in the URL are a tiny ranking factor but affect the overall SEO performance of your page. We have observed this for a long time and it is just an indication of the relevance of your page to Google and users. When users see the keyword of your URL through google results they are most likely to click your page.

Sometimes when you look at the URL of a site, you can identify what this page is about. The URLS like that have got proper slug to match the contents of the page.

Even google can classify the page content easily if it can analyze the keywords in the URL.

So due to these facts do not forget to put your target keyword in the slug.

This is one of the items in our WP on-page SEO checklist.


User-friendly URL

If you have a meaningful and user-friendly URL it brings some weight to the content of the page. This is something that you have full control and you can name your URL properly with the slug.

As you can see in the image, how easily users can see the URL in search results and the name of the slug is very simple and relevant to the contents of the page.

So you have to create a user-friendly and relevant URL  if you want to compete with these page results.

WordPress default site creates the URL like this

https://www.techiecontent.com?p=123

As you can see, this is not a user-friendly URL. So we call this type of URL is a dynamic URL with parameters.

You can create a URL with WP slug  like  www.wpruns.com/wp-seo-guide which is user-friendly and relevant to the topic. We name this type of URL as SEO friendly URL

Even by looking at the URL, the user will be able to make sure what he is going to read on that content. The search engine also loves to see readable URLs.

Link sharing

Suppose you are going to share following two links with other party

  1. www.wpruns.com/?p=23
  2. www.wpruns.com/wp-seo-guide

Look at the #1 URL Can you identify what is on the page when you look at the URL. No, you can not, you do not have even a clue about the page.

But in the second URL with a meaning full slug, someone can easily understand that this page is about “WordPress SEO Guide”.

Now you can understand the power of the slug in WordPress when you want to share a URL.

In the following section, we will see how to create user friendly URLs with WordPress slug

How do you create a slug in WordPress?

Before creating the slug for your page or post you have to edit some settings.

Go to Setting > Permalinks

Select the option  named “Post Name”

In this option when you create a post and name that it, the slug will be created automatically by separating words with dashes.

For example, if you create a post with the title “How to create Backlinks for the website” your slug will be

http://www.techiecontent.com/how-to-create-backlinks-for-website

But, you can easily change the slug before you publish, or even to customize the default slug after you publish a page.

On the right hand side of your post editor you can see the option for Permalink under Post tab as shown below

change your permalink

Now your URL is a user-friendly one but it is not optimized for search engines. Remember these slugs are unique to this page and you can not create another slug with the same name. But you can edit this slug with SEO plug-ins like Yoast or Rank Math.

If you want to edit the slug you can simply enter the text you need and save it.

How YOAST can edit slug

In the next section, we will see how to creates search engine optimized slugs

How to optimize WordPress slug for SEO

Now you know what the slug is and how to create a slug for your web page in WP. Now your task is to create optimized slugs (URLs) for your WordPress-driven website. I have listed several facts which you can use to create search engine optimized slugs or URLs for your page or post.

Here are tips to create SEO friendly URLs with slugs.

  • Keep your slug simple, relevant, compelling, and accurate.
  • The length of your WP SEO slug should have between three and five words. Then only SERP can show the URL on your screen fully and Matt Cutts of Google has mentioned this a long time ago.
  • Do not forget to include your target keyword in the slug.
  • Do not use stop words because stop word does not bring any value to the URL (words like “a”, “the”, “on”, “and”, “is”, “of”, “you” and other similar words)
  • URL should be meaningful but concise. So by looking at the slug one should be able to understand what he is going to expect on this page.
  • You can use a hyphen (-) to separate the word in the URL. Do not use underscore or any other character because this will increase the readability of your URL.
  • Use lowercase letters always in your slug.

Some important facts about WordPress Slug

Both user and Google can understand the content of the page if you can create a slug with above-mentioned qualities

Some web servers treat the following two URLs are two different ones, especially the Apache server running on a Linux machine.

www.techiecontent.com/wp-seo-101

www.techiecontent.com/WP-SEO-101

So avoid using capital letters in your slug as a rule.

Avoid the use of URL parameters if possible because they will create issues for duplicate contents.

The keyword effectiveness of your URL decreases as URL length and keyword position increase. So you always try to make short slugs and try to place the target keyword at the beginning of the slug.

Example of a good slug with target keyword:

When you change the slug in your post do not forget to add 301 redirects to the new page. Otherwise, the old URL will be identified as a broken link.

Editing slug in your post can have a positive effect on your ranking.


Further Reading