Managing WordPress Slugs – Here’s How and When to Change Them

Last Updated on February 17, 2023 by Sunny Staff

How time flies, right? It wasn’t that long ago that virtually every URL ended with a name like shop.php, order.asp, or thankyou.html. But things have changed considerably since then, and we now have point-and-click ease to change URLs to virtually anything we want since they are no longer file names, but simply slugs.

Interesting fact: back in the day the URL structure of a website was largely determined by how things were organized on the disk.  

For example, the URL of this page could have been:

http://www.sunnyhq.io/posts/wordpress/managing-wordpress-slugs-heres-how-and-when-to-change-them.html

managing-wordpress-slugs-heres-how-and-when-to-change-them.html would typically be a page in a folder called wordpress. wordpress, in turn, would be a subfolder in the posts folder. This got real messy real fast if you had a large number of pages (each one a separate file) in various folders and subfolders.

Fast forward to present day WordPress, where content organization is an automatic feature of the content management system (CMS). You no longer have to worry about where everything is stored on disk: it’s all managed and stored automatically – some on disk (e.g. media files, themes, and plugins), and some in a database (e.g. posts, pages, categories, and tags).

The URL slug

Definition: WordPress URL Slug

A slug is the name of your post, page, category, and tag in a URL.

URLs of pages, posts, categories, tags, and media are also generated and managed by the CMS. Every time you save or publish a page, post, category, or tag, WordPress automatically generates a slug based on the title. WordPress uses this slug to create a permalink.

Protocol Subdomain Domain Top Level Domain Category Slug
https:// www sunnyhq io posts managing-wordpress-slugs-heres-how-and-when-to-change-them

In the example above, the entire address is the URL or permalink of the post. The last part of the URL is the post slug. Just before it there’s ‘posts’, which (according to our permalink setup) is the category slug.

There are cases when changing the slug is necessary, like the above example. Looking at the category, we could probably be a little more specific than ‘posts’ since every post published on the site will qualify. The post URL can also benefit from a little brevity – rather than challenging visitors with managing-wordpress-slugs-heres-how-and-when-to-change-them, we can shorten the slug to something a little more eloquent, such as how-to-manage-wordpress-slugs.

Changing a URL slug is commonly done for SEO purposes, to enhance URL readability, or to change the information architecture of a website.

Is a URL Slug Important for SEO?

There is a lot of noise about keywords in URLs and how they affect SEO. But is it something you should worry about? According to Google’s John Mueller, not really.

We use the words in a URL as a very very lightweight factor. And from what I recall this is primarily something that we would take into account when we haven’t had access to the content yet. So if this is the absolute first time we see this URL we don’t know how to classify its content, then we might use the words in the in the URL as something to help rank us better. But as soon as we’ve crawled and indexed the content there then we have a lot more information. And then that’s something where essentially if the url is in German or in Japanese or in English it’s pretty much the same thing.

While the slug may only be important to search engines before the page is crawled, the URLs of your pages are nevertheless useful to your site visitors. It helps provide insight into the page’s content and can assist with site navigation.

Also read: SEO Solutions: What Is SEO (And Why Do I Need It?)

How to name a URL slug

  • Use clear and informative names for your URL slugs.
  • Use hyphens (not underscores), lowercase letters, and numbers. No spaces or special characters.
  • There is no length limit to slugs. But keep it up to a punchy max of 4 words.
  • Do not use dates or other long number sequences in slugs unless absolutely necessary.
  • Include SEO keywords in slug names when relevant.

Luckily, WordPress makes it super easy to change slugs of pages, posts, categories, and images.

Let’s take a look.

How to Change WordPress URL Slugs

It’s WordPress, so creating or changing the slug of a post, page, category, or tag is pretty straightforward. 

Important: Changing existing slugs can have a negative impact on SEO. Remember, search engines index URLs. When you change the URL of a page, that indexed page will be unavailable to site visitors. If you want to change the slug of published content, such as a post or category slug, you’ll have to permanently redirect those content items to the updated permalink (see below).

Also read: 7 WordPress Website Maintenance Mistakes and How to Avoid Them

Pages & Posts

WordPress will create a slug for a page or post based on the title when you save a draft or publish your content. If this is an unpublished or brand new page or post, you can change the slug without implementing a redirect. Here’s how:

  1. On the page / post edit page, select the Post tab.
  2. Find URL in the list and click on the post’s URL
  3. A URL popup will appear, with your post’s slug in a field under Permalink.
  4. Change the slug and press enter. Click Update to finalize your changes.

WordPress post edit screen

In the image above, I changed the post slug from hello-world to hello-sunny.

Categories & Tags

The process for changing the slug of a category or tag is exactly the same, with the only difference being the location of the category and tag edit pages. From the WordPress Dashboard, navigate to Posts > Categories to edit category slugs, or Posts > Tags to edit tag slugs.

Here’s how to edit a category slug:

  1. Click on the name of the category you wish to edit
  2. Make your changes on the Edit Category screen
  3. Click Update

WordPress category edit screen

In the example above, I changed the Category name from ‘Uncategorized’ to ‘WordPress Maintenance’ (Category Name). I’m also busy deleting the ‘uncategorized’ category slug and will replace it with ‘wordpress-maintenance’ since it’s descriptive of what we do and therefore the default post category, and also since it contains relevant keywords. 

Of course, the permalinks / URLs of any content published in the previous Uncategorized category now also change, as well as the URL of the post archive. On a live site this requires a permanent or ‘301’ redirect to divert traffic to the correct URLs. 

The same applies to tags.

While you can’t create or change slugs from the permalinks page, you can determine the structure of your URL – including where slugs are positioned in the URL – here. 

WordPress permalinks

From the WordPress Dashboard, navigate to Settings > Permalinks.

If your permalink structure is currently set to Post name you’ll see it reflected in the Custom Structure field as https://yourdomain.com/%postname/.

%postname is called a tag, which is simply a global placeholder for all post name slugs. At the bottom of the screen you’ll see a list of available tags, including:

  • %category% – a tag for category slugs (e.g. https://yourdomain.com/photography/blog-post)
  • %author% – a tag for author slugs (e.g. https://yourdomain.com/yourname/post-name) 

Customize the structure of your permalinks by selecting and completing the Custom Structure field with the appropriate tags. For example: /%author/%category/%postname%/ will create a URL containing the author, post category, and post name: https://mysite.local/leo/photography/choosing-camera-lenses/.

Nowadays it’s common practice to simply choose the Post name permalink structure.

Redirecting URLs in WordPress

Definition: URL Redirection

With URL redirection, or URL forwarding, traffic to one URL is redirected to another URL. Different redirect codes exist to describe the type of redirect. The most popular among these are 301, 302, 307, and meta refresh. A 301 redirect is used when URLs are changed permanently.

Whether you’re changing the slug of a single page, a tag, or an entire category of content, implementing redirects will preserve traffic as well as your search engine ranking. It also helps preserve visitor confidence since they’ll nevertheless find the content they’re looking for rather than being served a “404 Page Not Found” error.

So ensuring that your content can always be found is important.

There are various ways redirects can be implemented, with two of the most common adding lines of code to your site’s .htaccess file or the functions.php file. But there are also various plugins that can help get the job done without knowing a lick of code.

Many SEO and content management plugins include a redirect feature. But if yours doesn’t, then look no further than Redirection by John Godley – one of the simplest and most popular redirection plugins with more than 2 million active installs.

WordPress redirection plugin

What we really like about this plugin, aside from the redirect feature, is that it can monitor for permalink changes and automatically add redirects, and also track 404 “Page not found” errors on your website.

Once you’ve installed and activated the plugin, go to Tools > Redirection. Click on the Redirects tab and then Add New to add a new redirect.

How to add a redirect with Redirection plugin

Adding a redirect with the Redirection plugin requires two things:

  • A relative Source URL

A relative path or URL contains everything after the domain name. For example, where https://yoursite.com/category/uncategorized is an absolute URL to the archive page of posts in the ‘uncategorized’ category, /category/uncategorized would be the relative URL (it is relative to the domain).

  • A Target URL

The target URL is the new destination to which we want to send our visitors. This can either be an absolute URL or a relative URL. If we changed the slug of the Uncategorized category to wordpress-maintenance, the target URL would become /category/wordpress-maintenance.

Important: Relative URLs should only be used on the site’s domain. External URLs used as a target should be entered as absolute URLs.

Remember to stick to the permalink structure of your site as you redirect content to avoid accidental redirections in instances where you have categories, pages, posts, and tags with the same name. (That’s why we included ‘/category’ in the example above.)

Also read: How to Redirect a URL in WordPress

Is Managing WordPress URL Slugs Really That Simple?

Slugs are a great way to take control of how URLs are created and displayed on your website. But the ease with which they can be changed belies the potential complexity of redirection, especially when there are a bunch of exceptions to keep in mind (e.g. only redirect URLs containing a specific word). Making mistakes here could be costly.

At Sunny HQ, we eat redirects for breakfast, which means we can help you redirect from old slugs to new without losing any traffic along the way or getting on the bad side of search engines. Check out our WordPress management plans to see how we can help your site shine!

 *Limited period offer.

We won't bother you and promise to only give great deals and inspiration.

Signup for Special Offers