Get AI SEO for FREE.

Learn More!

What Is a Slug in WordPress?

Slugs for your posts, pages, and archives are important as they define how users can access your page and its content. So, In this knowledgebase article, we’ll walk you through what a slug is(in WordPress) and how you can set a slug by default with WordPress Editor as well as with Rank Math.

1 What Is a WordPress Slug?

In WordPress, the slug is the text that appears after your domain name in the URL of a specific page. For example, how-to-setup is the slug in the following image:

Slug Example

By default, every single public page on your WordPress site, including posts, pages, categories, and author archives, has its own slug.

Every time you create a new post, WordPress automatically sets the slug based on your permalink settings, but we do not recommend keeping the default settings as they are not user-friendly for both search engines as well as humans. You can go to WordPress Dashboard → Settings → Permalinks and change how slugs are generated.

Permalink settings in Rank Math

Sometimes, as in the example above, you’ll actually have two slugs back-to-back. This is because the “kb” part of the URL represents the slug for our Knowledge Base section, and the “how-to-setup” part represents the slug for the specific post. With the help of the Rank Math plugin, you can easily set the slug for post/pages, category/tags, and author pages.

2 Best Practices for Optimizing the URL/ Slug

Add Keywords: Add your keyword (1 or 2) to the end of the URL so that it’s easier for searchers and search engines to find your page and determine what is it about. For example, if your website is www.example.com and you want to target keywords like “example” or “keyword”, then you should add a keyword at the end of your URL and it looks like http://www.example.com/keyword.

Closely Matching to the Title: Make sure that the URL slug of a post or a web page is closely matching with the title of your post/ page. Also, you can’t just copy and paste the title of your post into the slug field. Because your URL slugs should always be a maximum of 60 characters and sometimes your title can exceed this limit and copying it will affect the SEO.

Eliminate Unwanted Words: By omitting pronouns and prepositions like “a”, “the”, “to”, etc. the slugs for your posts/ pages can be made shorter and more precise.

3 How to Set Slug in WordPress?

You can set the slug for a WordPress post/page whenever you’re creating or editing a post. If you’re writing a new post, please save it as a draft first.

3.1 Set Slug in Block Editor

In the case of Block Editor, open the Settings by clicking on the gear icon in the top-right corner of the page. Now under the Post panel tab, you can scroll down to find the Link section.

Permalinks settings in WordPress Block Editor

Here you can change the URL Slug.

Permalinks settings in WordPress Block Editor

Once you’ve edited, click the Save or Publish button.

3.2 Set Slug in Classic Editor

Below the Title box, you’ll see the Permalink URL with an Edit icon.

Edit permalink in Classic Editor

Once you click on Edit, you can edit the slug as shown below:

Set slug in Classic Editor

Click on OK and then Publish or Update your post.

3.3 Set Slug with Rank Math Snippet Editor

Alternatively, you can also use the Rank Math Snippet Editor to set a slug. In the Gutenberg Editor, click the Rank Math SEO icon in the top-right corner of the page or click the three vertical dots and choose Rank Math from the Plugins section.

Open Rank Math Metabox from WordPress Block Editor

In the case of Classic Editor, you can scroll down to the bottom of the Edit screen to find the Rank Math Metabox.

Rank Math Metabox in Classic Editor

In the Rank Math Metabox that appears on the screen, choose Edit Snippet under the General tab to open the Snippet Editor.

Edit Snippet

The Snippet Editor lets you change the SEO Title, SEO Description, Slug and includes more options. Under the Permalink field, you can change the slug. As you can notice, Rank Math includes a length bar to indicate the length of the permalink if it becomes too long.

Edit permalink in Rank Math Snippet Editor

Once you’ve edited the slug, you can Update or Publish the post.

4 How to Change WordPress Category or Tag Slug?

The process of setting a slug is identical for both categories and tags.

Go to Posts → Categories (for categories) or Posts → Tags (for tags). Then, look for the category or tag you want to edit, hover over it, and click the Edit button.

Edit tags in WordPress

Here you can edit the slug in the Slug field. Once done, click on Update.

Edit slug in Tag

Alternatively, you can also use Rank Math’s Metabox to edit the slug. But that said, Rank Math’s Metabox would be available for your taxonomies only if you’ve enabled the Add SEO Controls option under Rank Math SEO → Titles & Meta → Tags (or other taxonomies).

5 How to Change WordPress Author Slug?

 In order to change the Author slug, please head over to Rank Math SEO → Titles & Meta → Authors → Author Base and change the author base that was previously set.

Changing author base in Rank Math Titles & Meta settings

If you’re changing settings on an existing website that’s already receiving traffic, we recommend proceeding with caution & looking into putting redirects in place. If you’ve made any changes, don’t forget to hit the Save Changes button at the bottom of the screen to reflect the changes.

6 What Happens When You Change the Slug After Publishing?

When you change the slug of a page after publishing/page that is already driving traffic, then your visitors and crawlers landing on the old URL will no longer be able to access the content. Instead, the browser will return a 404 error, which means that the requested page is not found.

To ensure that you don’t lose your potential traffic to your content while changing slugs, you should redirect the URLs with the old slug to the new ones. If you happen to change the slug of any traffic-driving pages, you can redirect your old URLs using Rank Math.

And, that’s it! We hope the article was helpful in understanding WordPress slugs. If you still have any questions, feel free to reach our support team directly from here, and we’re always here to help.

Still not using Rank Math?

Setup takes less than 5 minutes including the import from your old SEO Plugin!

Learn more about the PRO Version

Still need help?

?

Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket

Related Articles