What is a domain name? Image of web browser

What is a WordPress Slug?

Your website’s post and page URLs can be an important part of your overall strategy. They can affect the way you share content, and your site’s Search Engine Optimization (SEO). Often, this involves customizing them to better suit your brand.

Fortunately, WordPress ‘slugs’ are much more helpful than your garden-variety pest. While editing this part of the URL for a WordPress post or page is pretty simple, there are a number of elements to consider along the way.

In this article, we’ll take a deep dive into WordPress slugs. We’ll cover what they are, why they’re important, and where to find them. Then we’ll discuss how to set up and optimize them. Grab your garden gloves and let’s get started!

What is a Slug? 

A WordPress slug is the part of a post or page’s permalink that comes after the domain name. For example, in the WordPress URL “https://mysite.com/first-blog-post”, the slug is “first-blog-post”. This element is usually automatically generated, and describes the page’s content or reflects its post title:

Your content’s default slug can be found under the Permalink menu that appears on every blog post and page. There are several other places slugs can be located on your WordPress site, however, and we’ll look at those next.

WordPress Slug vs. Permalink: What’s the Difference?

A permalink provides a direct, permanent link to a section of your site. In the example above, “https://mysite.com/first-blog-post” is a permalink that leads to a singular page.

The slug, as mentioned, is “first-blog-post.” Slugs are the shorter end portion of a permalink, designed to communicate the page content to users and search engines. In short, all slugs are part of a permalink, but not all permalinks will have a slug.

Where Slugs Are Found

All of the public pages on your website have slugs. For example, you can find and edit slugs when creating the following:

  • Posts: Slugs are automatically generated for both standard and custom post types.
  • Pages: When you create a page, slugs are an editable option.
  • Author archives: The slugs for author pages can be changed, but this requires a plugin that we’ll discuss later on.
  • Categories: We’ll cover more on how to do this in a moment, but in general, category slugs are handled much like the custom post type slug.
  • Tags: Editing slugs for your tags can be approached in the same way as categories, but from the Tag menu in your dashboard.

We’ll discuss how to edit different kinds of slugs in a moment. Overall, however, it’s important to keep in mind that any slug editing that takes place after you have published the relevant piece of content will need special attention, in order to avoid broken links and other errors.

Why Are Slugs Important? 

Slugs are a key part of your website’s permalink structure. For this reason, when it comes to SEO, slugs are extremely important. What’s more, being able to change them manually can be a useful tool.

Sometimes slugs that are auto-generated are very long and not as relevant as your hand-picked keywords might be. Therefore, we suggest optimizing your slugs before you publish each page or post. Custom slugs can boost your SEO rankings, and let your readers know what to expect.

How to Set Category Slugs in WordPress

Within WordPress, setting category slugs is pretty straightforward. This doesn’t require a plugin, and can be accomplished in just a few simple steps.

Step 1: Navigate to Your Post Categories Menu

From your WordPress admin dashboard, navigate to the Posts menu. There you’ll find a Categories option:

Once you open the categories settings page, you’ll notice that it’s set up very similarly to the posts settings page. From here, you can change a category’s slug without opening its individual page.

Step 2: Edit Your Category Slugs

From the Quick Edit menu, you can easily change the short slug for a specific category. Remember that your chosen slug should be made up of lowercase words or phrases. If you use more than one word, you’ll need to put a hyphen between each one:

If you want to change or add a category description, you will need to open the category by clicking on it. Then, you’ll see its expanded options and settings, which you can modify as needed.

Step 3: Save Your Changes

Once you complete your changes, make sure to save your edits by clicking on the Update button. This applies to both the Quick Edit option and the full category settings page:

Also, keep in mind that if you change an existing category’s slug or merge two categories into one, you will need to do a little housekeeping. If you are using category URLs in a menu or somewhere else on your site, you’ll want to create a redirect so that bookmarks and search engines will still be able to find the content at its new location.

How to Set Author Slugs in WordPress

There may be times when you want to customize the way a site user’s name shows up in page URLs. To do this, you can customize the author slug just as you can with a blog post or category. Setting up an author slug is slightly more complicated, however, so let’s look at how the process works.

Step 1: Download and Install a Dedicated Plugin

To customize your author slugs, you’ll need to download and install a plugin. The easiest way to do this is from your Plugins page in WordPress:

After selecting Add New, you can do a quick search for ‘author slug’. You should find the Edit Author Slug plugin, which you can install and activate on your site.

Step 2: Edit Your Author Slug Settings

Once you activate the plugin, you can navigate to your Users menu. From there, you can select any user and view their individual settings. At the bottom of this page, you’ll now find additional settings for the author-specific slug:

You’ll be given a number of preset slugs to choose from, and also the option to create a custom author slug.

Step 3: Alter Your Slugs as Needed

You also have the choice to have all users appear under one slug, or you can create custom slugs for particular users. Whatever you choose for each user is what will appear in the URL for their author archives page.

For instance, if you have many outside users who contribute to your site but you want to present a uniform brand, you can create a single author slug to represent all contributing writers. Alternately, you can give each writer their own unique URL.

How to Change a Slug in WordPress

WordPress creates a slug for you every time you make a new post, but it may not always be the best slug. Thankfully, when you want to change a slug, WordPress makes it easy—no plugins required. Here’s how to edit the slug of an existing post.

Step 1: Change Permalink Structure

Before you start altering slugs, you should change your permalink structure from the default “Day and name” setting. To do this, go to Settings > Permalink, and choose “Post name” (the best option for SEO purposes). Ideally, you’ll complete this step before publishing your site, as slugs made under an old structure do not update automatically.

Step 2: Locate Your Post

To find the post slug you’ll be changing, navigate to Post > All Posts on your WordPress dashboard. Hover over the desired post, and click on the Quick Edit option.

Step 3: Update Slug Name

In the window that follows, you’ll see a variety of fields you can edit. Enter your new slug into the Slug field using only lowercase letters and hyphens instead of spaces.

Click Update in the bottom right corner, and your changes will be saved.

Step 4: Test for Errors

When changing a slug after your site has been published, it’s vital to ensure that the old slug redirects to the new one. Otherwise, you’ll end up with broken links. A redirect plugin like Redirection can help you avoid errors.

After setting up your redirect plugin, paste the old slug into a new tab to confirm it redirects properly.

Optimizing Slugs

Slug optimization is a vital part of any SEO strategy. In fact, URL length, structure, and word choice all have an impact on your site’s Google rankings.

There are a few key elements to keep in mind while optimizing your WordPress URL slugs, including:

  • Length. In general, shorter URLs perform better on Google. Research shows that the sweet spot is between 50 and 60 characters.
  • Readability. Ensuring that your URLs are readable is important. When web users see a URL that’s a long string of letters, numbers, and symbols, which doesn’t tell them anything about what the content is actually about, they’re unlikely to click on it.
  • Style. It’s also best to stick to a few best practices when it comes to URL style. For example, it’s recommended that you use hyphens rather than underscores. Slugs should also be in lowercase format, and avoid the use of stop words.
  • Keywords. The general recommendation is to keep the use of keywords in your URLs to one or two. It’s also important to note that keyword repetition in your URL won’t gain you anything in terms of Google rankings.

Slugs are just one element in your overall URL structure. While they are part of the permalink family, it’s important to understand them as an individual component as well.

Keep Your Site Optimized With WP Engine

You might not want slugs in your garden, but when it comes to your WordPress site about gardening, that’s another story. Keeping tabs on your slug strategy and optimizing your URLs by editing your slugs before publishing can have a positive effect on your site’s rankings.

Here at WP Engine, we want you to have the best resources for your WordPress website. That’s why we offer more than just hosting. Our exceptional WordPress hosting and plans can help you create a site your customers won’t forget!

Get started.

Build faster, protect your brand, and grow your business with a WordPress platform built to power remarkable online experiences.