In general, slugs are part of the individual permalinks used by posts, pages, categories, and terms. Of course, this is not their primary use, as you shall see below.
The following article discusses slugs, which are used by WordPress’s native permalink system. You will discover how slugs are generated and how to modify them. The second part of the article contains instructions for using Permalink Manager to better manage the slugs.
A WordPress slug is the text that appears after your domain name in the URL. Slugs, which appear at the end of URLs, are the most important part of a permalink since they allow WordPress to identify each piece of content on your website.
Unfortunately, there are certain drawbacks of using slugs, which are briefly discussed later in this article. One of the most frustrating shortcomings of the built-in permalink system, for example, is that the same slug cannot be reused. In other words, even if the rest of the permalink is unique and the URL is unique, you can only use the native slug once.
Permalink Manager, unlike the built-in permalink system, allows you to use the same slug multiple times. The plugin detects URLs using its own algorithm, which is more advanced than the built-in permalink system. It makes no difference whether or not your new custom permalinks include the slugs or not. This allows you to completely customize and update your URL addresses whatever you like.
What is a WordPress slug?
Most people may find it challenging to comprehend all of the nuances associated with WordPress slugs, so let us stick to the basics. Simply described, a slug is a text-based identifier that is saved in the database and assigned to individual posts, pages and terms much like a numeric ID.
The primary use of the slugs is to identify what post, page, category or term should be loaded. This is not the only place where they show up, since WordPress also makes use of them in its URLs. The slug is located at the end of them.
Let us not forget one last point before we wrap things up. The URL with the slug may appear above the title on search engine results pages. You should be aware that long URLs are truncated in search results, and their end part containing the slug may be hidden. Simple and comprehensive slugs, on the other hand, will attract more clicks and visitors to your website.
If you are still unsure, the following table will help you understand the difference between permalinks and slugs. As you can see, the slugs are determined by the titles.
|WordPress Slugs: Guide||wordpress-slugs-guide||https://example.com/wordpress-slugs-guide|
How does WordPress create slugs?
The slug is based on the initial post/term title and is assigned to the post or term once it is published. As a result, even if you modify the post/term title later, the slug will remain the same. It implies that if you want to update it, you must do it manually in the slug editor.
When the slug is generated, WordPress will sanitize the title, removing non-standard characters and leaving just Latin letters and digits. Furthermore, the slugs will be converted to lowercase. If it contains more than one word separated by spaces, each one will be automatically replaced with a hyphen (–).
Since WordPress generates the slug based on the current title when publishing the post, it is advisable to check that it is optimized for potential visitors who may discover your site in Google results.
How to edit the WordPress slugs?
For the sake of thoroughness, we should also add that the following instructions also apply to WooCommerce slugs. Although the screenshots below illustrate a post, a custom post type item, and a category, the instructions may be applied to products, product categories, and product tags as well.
Depending on whether you want to adjust the slug for a page or a category, the field to edit the slug may be located elsewhere. When using the Classic Editor, this field is not immediately displayed for posts or pages. Simply clicking on the “Edit” button should give you instant access to this useful feature. After that, you should see an input field where you may change the slug.
WordPress provides an additional convenient way for editing slugs. To utilize it, simply open the “Quick Edit” panel on the administrative page where the list of posts is displayed.
How can I edit the WordPress slug in the Gutenberg editor?
In the new Gutenberg editor, changing the slug is a much simpler. To do so, just locate the input field in the sidebar’s “Permalink” section.
How do I change the slugs of categories and custom taxonomy terms?
The situation is different when it comes to modifying WordPress slugs for categories, tags, and other taxonomy terms. This field will be presented directly in this instance, and you should have no problem finding it.
How can I use Permalink Manager to make changes to the WordPress slug?
Because URLs created using Permalink Manager may be totally personalized, they do not have to include native slugs. However, if required, they may be edited straight using the URI Editor.
By default, the native slug editor is not shown in the admin interface. If you need to change the native slugs for whatever reason, you can utilize the URI Editor’s slug editor. To do this, turn on the ‘Show “Native slug” field‘ option in Permalink Manager settings, as shown below.
Permalink Manager will display an extra field within the URI Editor if the “Show native slug field” option is checked, as illustrated below.
WordPress slug limitations
For the most part, the inbuilt permalink system based on native WordPress slugs is pretty limited. It does not provide any user-friendly solution to customize the URL addresses. This could be a real problem if you need a tailored permalink structure or simply want to quickly change URLs individually.
Why the native WordPress slugs needs to be unique?
To keep things simple, if the slugs had not been unique, WordPress could not have indicated what content element needs to be loaded. Technically, you cannot use the same slug for more than one post or term. It means that WordPress will automatically append the numeric index (eg. “-2”) to the end of slug, if you have previously used it for another post or term.
|Post title||Post slug||The original permalink|
|Hello World |
As you can see above, WordPress appended “-2” to the slugs of posts/terms with duplicated title. It does not matter if the rest of permalink is different and URL is unique as a whole. You can add as many homonymous (posts/pages/term with the same title) title, but the native slug will always be unique.
How to duplicate the slugs using Permalink Manager?
By default, it is not possible to use the same slug using inbuilt WordPress permalinks. If you try to use the slug more than once, WordPress will append numeric indexes to the end of permalink. It is really frustrating especially if you would like to use the same title for multiple subcategories or child pages assigned to different parents. This limitation is also indicated in the official documentation on the WordPress.com website.
The native slugs are also included by default in the permalinks created by Permalink Manager. You may, however, freely edit them and overwrite the default permalinks with your own. Unfortunately, as previously stated, WordPress does not allow the use of the same slug in another post/term native permalink.
This problem may be solved by using Permalink Manager, which allows you to reuse the same slug across multiple content items. It is because the plugin leverages an unique algorithm to detect permalinks and hence does not require any of the native WordPress slugs to be included in.
There are two basic ways to remove the numerals appended (eg. “duplicate-slug-2“) to the permalinks:
- You can manually remove the numerals appended to the slug in individual permalinks.
- You can make Permalink Manager use the actual titles instead of native slug in the custom permalinks.
How to adjust the slugs manually?
The easiest method to reuse the same slug is to use “Current URI” field in URI Editor:
How to use actual titles instead of native slugs?
The manual adjustments of individual custom permalinks could be time-consuming. The alternative solution to allow slug duplicates is to select “Use actual titles as slugs (Force custom slugs)” mode in “Slugs mode” in the plugin settings. When enabled, Permalink Manager will always use the actual title (eg. “Shoes“) instead of the native slug (eg. “shoes-2“) in the custom permalink.
Please keep in mind that the adjustments will only be applied to new posts and terms. If you wish to apply them to existing items, you must use the “Regenerate/reset” option.
Check for permalink duplicates
Permalink Manager can detect permalinks with duplicated slugs because it uses a custom algorithm to detect the URLs. Shortly, it checks the full URL address instead of the native slug (part of URL). Hence, the slugs can be reused, but still you need to make sure that the full URL address is unique.
Concurrently, you can always check if any of custom permalinks is duplicated in “Permalink Duplicates” section. To display it, please go to “Tools -> Permalink Manager -> Tools -> Permalink Duplicates” admin page.