What is: Slug?

The terms “slug” and “post slug” are virtually identical, the only difference being that a “post slug” refers specifically to WordPress posts while “slug” is a general term that can also refer to different elements in a URL.

Using Slugs In Wordpress

In WordPress, the term “slug” refers to the unique part of a URL that is generated for every post, plug, and comment. In essence, it is the “suffix” or the part that follows the domain name. For instance, if your WordPress site was hosted at “www.MyAwesomeBlog.com,” and you had a post with the URL “www.MyAwesomeBlog.com/2018/09/life-is-great” then everything starting with “2018” and after is the slug.

Every time a post or page is published, WordPress will automatically add a slug to create a unique URL. You can modify this slug for each post or page by editing it in the section of the Text Editor just underneath the title of the post or page. Keep in mind, however, that after a page or post is published, any links to it from outside sources will stop working and become “broken” if you change the slug.

Note: Because of the way the internet works, all URLs and therefore slugs can contain letters, numbers, and symbols but never spaces!

Most versions of WordPress also allow you to change how slugs are automatically generated for each post or page. By going to the Admin Screen and clicking on “Settings” on the left, you should see a section called “Permalinks.” This is another WordPress term that refers to how URLs are generated, including the slugs. In this section, you can decide whether to create slugs with or without the date, with or without the author’s name, and whether it should or should not contain information about the category to which a post belongs.

If you prefer, you can also change how slugs are generated by modifying the “.htaccess” file in your WordPress root folder.

Best Practice Using Slugs

Best practices for creating a slug include keeping it short, using hyphens to separate words, including relevant keywords for your post, and ensuring it’s unique within your website.

For example, if you’re writing a blog post about homemade pizza recipes, a good slug might be “homemade-pizza-recipes”. This slug is descriptive, contains relevant keywords, and is easy to read.

The following two tabs change content below.

Jamie Spencer

My name is Jamie Spencer and I have spent the past 10 years building money making blogs. After growing tired of the 9-5, commuting and never seeing my family I decided that I wanted to make some changes and launched my first blog. Since then I have launched lots of successful niche blogs and after selling my survivalist blog I decided to teach other people how to do the same.