What is Slug in WordPress

When we write a post in WordPress, first we write a title. Your title may be: My First Awesome Post. When you finished writting you must specify an URL for your awesome post.  Otherwise no one can see your post on the Internet. So what should be your URL? Should it be something like the following?




The above format is just not very readable for humans and search engines as well. The slug comes to the rescue! First, slug will make all your letters lowercases. Then it separates your words in the title with dashes or hyphens. Punctuation marks will be removed. So your URL should be something like this:


Now it becomes much more readable for human eyes.

A slug is part of a URL, the last part to be exact.  In the above example, the slug is my-first-awesome-post. It’s not the entire URL. If your URL structure is like this:


Then the slug is still my-first-awesome-post. Because slug is a few words that describe your post or page.

When an URL is in this format, we say it’s a slug URL.

In WordPress, slug is generated automatically from a post title or page title but you can change it to suit your SEO needs. If you title is too long, you would likely want to change the slug to keep your URL short and hence make it easier for search engines to crawl your web pages. It is usually a good practice not to change the slug after publishing your post or page.

One Interesting thing to note is that After WordPress generates a slug for your post or page, it will be the same even if you change the title. You have to manually change it if it needs to be changed.

Additional Reading: WordPress Glossary: Slug

Rate this tutorial
[Total: 0 Average: 0]

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here