What is a WordPress Slug and How To Change It?

Although the answer to the question what is a WordPress slug may seem obvious to some, it is still worth going through the technicalities. If you were to sum up what a slug is in a few words, it is the text that appears after your domain name, at the very end of the URL. Of course, this is not their primary use, as you shall see below.

You may have come across the phrase "slug" in reference to WordPress as a website owner or developer. So what exactly is a slug, and why is it crucial for your website's SEO? In this post, we will look at what a WordPress slug is, how it affects your website's search engine results, and how to change it if necessary.

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.

It may be pointless to describe all of the nuances of WordPress slugs to a casual user, therefore we will focus on the definition and the most important information. Slugs are, without a doubt, the most crucial aspect of a permalink since they allow WordPress to recognize each item of content on your site.

How to duplicate slugs?
If you already know what slugs are or are not interested in this topic, you may continue to the second section of the article, where you will find instructions on how to use Permalink Manager to duplicate slugs.

Unfortunately, there are certain drawbacks of customizing 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 them only 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 in a Nutshell?

Simply described, a WordPress 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 them 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. In general, they are located at the end of them.

Permalink example
The slug is typically located at the end of the permalink and is created by using the title of the page or post and converting it into a shorter, URL-friendly string.

In terms of search engine optimization (SEO), the slug can play a key role in how your permalinks are perceived by search engines and how they appear in search results. By optimizing your slugs, you can make your permalinks more descriptive and relevant to your content, which can help to improve the visibility and ranking of your pages in search results.

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. Either way, simple and comprehensive URL addresses will attract more clicks and visitors to your website.

Slug displayed in SERP (Google Search Results)

It should be noted that the WordPress slug differs from the permalink, which contains the domain name and any additional subdirectories. The permalink is the whole URL that visitors and search engines use to access your content, whereas the WordPress slug is merely a portion of that URL.

If you are still unsure, the following table will help you understand the difference. The table below illustrates how the slugs are derived from the titles and then simplified for usage in canonical URLs.

Title Slug Permalink
WordPress Tutorials wordpress-tutorials https://example.com/wordpress-tutorials
Cotton T-Shirt cotton-t-shirt https://example.com/products/cotton-t-shirt
Tutorials shoes https://example.com/category/tutorials

Why is the WordPress Slug Important?

The slug of your WordPress site is very important for a number of different reasons. For starters, it helps search engines in determining the topic of your article or page. Search engines can simply detect the topic of your article and rank it if you include keywords in your slug.

The WordPress slug is also vital for user experience. A well-crafted slug may help readers remember and share the URL of your article or page. Visitors are more likely to click on a link with a concise and easy to understand URL that correctly conveys the page's content. Furthermore, an organized URL structure can help people browse your website and locate relevant information. This can result in more engagement and a lower bounce rate, which can help your SEO efforts indirectly.

To summarize, the WordPress slug may appear to be a little and insignificant detail, but it may have a huge influence on the SEO and user experience of your website. You may boost your chances of appearing better in search results and engaging your audience by crafting optimized WordPress slugs that include relevant keywords, eliminate stop words and special characters, and appropriately describe your content.

Take the time to analyze and optimize your WordPress slugs, and remember to prioritize both search engine performance as well as user experience when building the URL structure for your website.

SEO Tips
First of all, you should make the slugs as simple and relevant as possible. Between three and five words is considered the ideal slug length. Shortening slugs by deleting stop words or unnecessary words like "the" "and" "in" and so on might be a good idea. This is due to the fact that stop words have little to no SEO influence.

How Does WordPress Create Slugs?

Now that you understand what is a WordPress slug, we will go through how they are produced. 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, it will remain the same. It means that if you wish to change so, you will have to do it manually using the admin interface.

When the slug is generated, WordPress will sanitize the title, removing non-standard characters and leaving just Latin letters and digits. If it contains more than one word separated by spaces, each one will be automatically replaced with a hyphen (–). Furthermore, for better consistency, all capital characters will be transformed to lowercase.

As you can see, there is not a lot of room for modification here. For the same reason, If that was not bad enough, WordPress does not let you use arbitrary slashes in your URLs. To include them in custom permalinks, you will need to install a 3rd party plugin like Permalink Manager.

Given that WordPress generates the slug based on the current title when publishing the post, it is important to ensure that it is optimized for potential visitors who may find your site in Google results.

What Is the Problem With the Native WordPress Slugs?

For the most part, the inbuilt permalink system based on native 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.

This may be a big issue from an SEO standpoint, however WordPress happily allows developers to fill in the missing functionality. This is exactly why Permalink Manager was created: to provide you more flexibility by extending the built-in permalink system. Before we get into some examples of how you may utilize it to your advantage, we will go through one of the most common issues with in-built WordPress slugs.

Why WordPress Adds “-2” to the Slugs?

The inability to reuse the same slug for multiple posts or pages is probably the most annoying aspect of WordPress. If you have discovered that your permalinks are not quite right, and that WordPress has appended "-2" to the slugs, you are probably asking why.

Simply put, if the slugs had not been unique, WordPress would have been unable to determine which content type 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 hello-world http://example.com/2019/11/20/hello-world
Hello World
hello-world-2 http://example.com/2020/11/15/hello-world-2

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.

Sample post permalink with duplicated WordPress slug
Duplicated post: The second post has the same title, but different native slug (hello-world-2).

How to Edit Slugs From WordPress Admin Dashboard?

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.

How to edit slugs with Permalink Manager?
The process for editing native slugs differs if you use Permalink Manager. You can accomplish this using the plugin's built-in URI Editor.

Depending on whether you wish to change the slug for a page or a category, the field to do so 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 make the adjustment.

Click "Edit" to display the WordPress slug

A sample slug field

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.

WordPress comes with a "Quick Edit" panel.You can also edit WordPress slugs also using "Quick Edit" panel

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.

Edit WordPress slugs in Gutenberg editor

Custom Taxonomy and Category Slugs

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 to edit WordPress slug for terms?

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 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.

Show "Native slug" field

Permalink Manager will display an extra field within the URI Editor if the "Show native slug field" option is checked, as illustrated below.

"Native slug" field inside URI Editor

How to Duplicate the Slugs?

By default, it is not possible to use the same slug using inbuilt WordPress permalinks. If you try to use it 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 issue is also mentioned in the official documentation on WordPress.com. Using Permalink Manager, however, this flaw may be readily addressed. To cut a long story short, the plugin allows you to reuse the same slug across multiple content items since it uses a unique algorithm to detect permalinks and hence does not require any of the native slugs to be included.

The same slug used in different categories

Keep in mind that the native slugs are also included by default in the permalinks generated by Permalink Manager. You may, however, freely edit them and overwrite the default permalinks with your own. There are two basic ways to remove the numerals appended (eg. “duplicate-slug-2“) to the permalinks:

  1. You can manually remove the numerals appended to the individual permalinks.
  2. You can make Permalink Manager use the actual titles instead of native slugs in the custom permalinks.

How to Adjust Them Manually?

The easiest method to reuse the same slug is to use "Current URI" field in URI Editor:

Current URI
Duplicated post: You can make the custom permalink completely different. It means that, you can reuse the original slug (hello-world) even if the native slug is different (hello-world-2).
Sample permalinks with slug duplicates
You can also duplicate the slugs in Bulk URI Editor.

How to Use Actual Titles Instead of Them?

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.

How to use titles instead of slugs and automatically update WordPress permalinks?
Please check "Slugs mode" article to find more information on this functionality. Unlike the original WordPress permalinks system, you may also have the URL automatically updated if the title changes. The more precise instructions may be found in a separate document.

Use post titles in the native slugs

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.

Duplicated permalink alert in URI Editor
If your new custom permalink is not unique, a duplicate notice will appear below the input area.

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.

"Permalink Duplicates" section

Frequently Asked Questions

A permalink is the permanent URL structure of a page or post on your website, whereas a WordPress slug is the portion of the URL that follows the domain name and identifies the individual page or post.

Can I Change the WordPress Slug After Publishing a Post?

Yes, it is possible to change the WordPress slug of a published post or page. Nevertheless, if not done correctly, updating the WordPress slug may result in broken links and have a negative impact on your SEO. It is preferable to avoid changing WordPress slugs unless absolutely essential.

How Long Should My WordPress Slugs Be?

WordPress slugs should ideally be less than 50 characters long, as larger slugs may be shortened in search results. However, it is more important to concentrate on designing a WordPress slug that is descriptive and accurate, and that precisely reflects the content of the post or page that you are working on.

Can I Include Special Characters in My WordPress Slugs?

Special characters should be avoided in WordPress slugs since they might cause difficulties with URL encoding and may be difficult for visitors to input or remember. In order to get the best results, only use letters, numbers, and hyphens.

Go up