The slug is the text identifier of a content (post/article, page or custom content type) or a taxonomy (category, tag or other). It is also found as part of the permalink on these pages, which is the part that represents the name of the post. Each slug must be unique.
WordPress automatically generates a permalink from the title of a post. Also remember that the ideal format of a permalink is the “name of the post”.
When creating the permalink, punctuation such as commas, quotes, and apostrophes, as well as invalid characters such as accents, are removed and spaces are replaced with dashes to separate each word.
Let’s take an example with the following article “How to create a unique style guide for your website? ” :
- WordPress had automatically generated the following permalink:
https://wpmarmite.com/en/how-to-create-a-unique-style-guide-for-your-website/, title a bit long.
- This permalink was manually modified to
https://wpmarmite.com/en/website-style-guide/as the final version.
In this example, the slug is
website-style-guide. When the permalink is updated, the slug is also updated.
You can retrieve the slug in the editing screen of a post or a page. Click on the screen options in the upper right corner to display the ID on your editing screen.
A second way to display it is through the menu Posts > All Posts or Pages > All Pages and select “Quick Edit“ for the post or page you wish to modify.
Once the post has been published, the slug must not be touched anymore. If it is modified, the links to your post will be broken and this will create 404 errors.