Skip to content

What is a slug in WordPress and when to change it

A WordPress slug is the short, editable part of a URL that names one post, page, product or category, like about-us in example.com/about-us/. Choosing a good slug before you publish costs nothing. Changing it after the page is live is a URL change, and it needs a redirect.

On this page
  1. What is a slug in WordPress, exactly?
  2. How is a slug different from a permalink?
  3. How does WordPress create a slug?
  4. Where do you find and edit a slug?
  5. Why did WordPress add -2 to my slug?
  6. What happens when you change a published slug?
  7. Do slugs help SEO?
  8. Why does a page return 404 after a slug or permalink change?
  9. Frequently asked questions

Key takeaways

  • The slug is one segment of the URL. The permalink is the whole address, and Settings > Permalinks sets the pattern for the whole site.
  • Retitling a published post or an existing WooCommerce product leaves its slug as it was, so the URL stays stable until you change it yourself.
  • A -2 on the end of a slug means something else already has that slug, often an item in Trash or a Media file. You fix it in the dashboard.
  • Saving Settings > Permalinks refreshes rewrite rules. It does not redirect an old URL and it does not fix a real name collision.
  • Slugs help readers more than rankings. Google asks for readable, hyphenated URLs, but leaving a working URL alone usually beats a cleaner one.

Your page is called “Emergency Plumbing Services” and its address ends in /emergency-plumbing-services/. That last segment is the slug. It looks like a small text field. It is also the public address that bookmarks, emails, ads and search results point to.

The definition takes one sentence. The trouble starts around it: a stray -2, a page that returns 404 after a rename, or a “quick” permalink change that breaks every link on the site. This article covers what a slug is, how WordPress makes one, and how to change one without losing traffic.

What is a slug in WordPress, exactly?

A slug is the readable, URL-friendly name of one item on your site. It is usually the last part of the URL. In example.com/about-us/, the slug is about-us. Posts, pages, WooCommerce products, categories, tags, custom post types and authors all have one.

Child pages build on their parent’s slug. In example.com/services/consulting/, consulting is the child page’s slug and services is the parent’s. If you change the parent’s slug, the child’s URL changes too.

The word means other things in WordPress as well. A plugin slug is the folder name a plugin uses in the directory. An author slug is the public name in an author archive URL. This article is about content slugs, the ones you see in the editor. If you are still setting up your site’s structure, our guide to adding pages in WordPress explains why the slug is worth deciding before launch.

The slug names one item. The permalink is that item’s full address. The permalink structure is the site-wide pattern that decides where the slug sits in the address. WordPress’s permalink documentation describes permalinks as the permanent URLs of your posts and pages, and you set the structure under Settings > Permalinks.

Permalink structureExample URLWhere the slug appears
Plainexample.com/?p=123Not in the URL at all
Post nameexample.com/first-post/The whole path
Day and nameexample.com/2026/10/15/first-post/After the date
Customexample.com/blog/first-post/After a fixed base

Keep the difference in mind, because the two changes carry very different risks. Editing one slug changes one URL. Changing the structure changes every post URL on the site at once.

WordPress permalink settings screen with structure options for the slug
The WordPress permalink settings determine the global URL architecture, controlling exactly where each post slug appears across the entire site. · Source: www.boldgrid.com

How does WordPress create a slug?

WordPress builds the slug from the title when you first save. It lowercases the text, turns spaces into hyphens and strips punctuation and characters that are not allowed in a URL. The core function that does this, sanitize_title(), also converts accented letters to plain ASCII where it can. “Café Menu” becomes cafe-menu.

Non-Latin titles are where the automatic slug lets people down. Developers often complain that slug tools handle umlauts, apostrophes and Cyrillic badly. If you publish in Chinese, Russian or Hebrew, look at the generated slug before you publish and decide whether you want a transliteration, a translation or the original script.

One behaviour surprises a lot of people. Once an item is published, changing its title does not change its slug. WooCommerce’s product editor documentation says the same for existing products. That works in your favour: you can retitle a page as often as you like, and its URL stays put until you edit the slug yourself.

Where do you find and edit a slug?

Where the field sits depends on the editor and the content type. The job is always the same: open the item, find the URL or slug field, change it, save, then load the new URL.

  • Block editor (posts and pages): open the Settings sidebar with the panel icon at the top right, pick the Post or Page tab, and click the URL or slug field. WordPress.org’s Settings sidebar documentation covers this panel. The label has moved between versions, so look for the URL in that tab.
  • Classic editor: the permalink appears under the title once a draft is saved. Click Edit next to it.
  • Categories and tags: go to Posts > Categories or Posts > Tags and use Quick Edit next to the term. A category slug change moves the archive URL and every link to it.
  • WooCommerce products: use the Edit link next to the product URL, or the slug panel. Product and category bases, such as /product/, are set separately under Settings > Permalinks > Product permalinks.

Save a draft before you publish, so you can check the slug before any visitor or crawler sees the URL.

Editing a WordPress slug in the block editor settings sidebar
Selecting the Page tab in the sidebar reveals the permalink panel where you can inspect and refine your URL slug prior to publishing. · Source: taylorhieber.co

Why did WordPress add -2 to my slug?

Something else already uses that slug. WordPress won’t give two items the same address, so it appends a number. The suffix is a symptom, not an error, and the item causing it is usually one you have forgotten about.

Check these places in order:

  1. Trash. A trashed page still holds its slug. A WordPress.org forum moderator points to trashed posts and leftover imports as the usual culprits.
  2. Media. Uploading pricing.jpg can give the attachment the slug pricing, and then your Pricing page becomes pricing-2.
  3. Drafts and other content types. An old draft, a product or a custom post type item can hold the slug.
  4. Numbers only. A slug made only of digits, like 2026, can get a suffix too, because WordPress may read it as an ID or a date.

Once you have found the item, delete it permanently or change its slug. Then go back to your page and type the slug you want into the field. WordPress will not rename the -2 page for you when the original goes. Clear your cache and load the URL.

That same moderator also warns against deleting database rows to clear a hidden conflict. Use the admin screens first. Some cases stay stuck. One WooCommerce store owner on Reddit reported -8 suffixes on variable products coming back after hours of cleanup, and nobody posted a confirmed fix. If you reach that point, it is a job for a developer.

What happens when you change a published slug?

The old URL can stop working. Every link pointing at it, from your menu, other sites, old emails or Google’s index, can then land on a 404. A published slug change is a URL migration, however small the edit looks.

WordPress gives you some cover, but not everywhere. It remembers old post slugs and often redirects them. WPBeginner’s redirect guide says this covers posts but not pages. Plugins and server rules can also get in the way. Don’t trust it. Test the old URL every time.

To change a live slug safely:

  1. Copy the full old URL, including any parent path or language prefix.
  2. Change the slug and save.
  3. Add a permanent 301 redirect from the exact old URL to the new one. Our guide to redirecting a WordPress page walks through the options.
  4. Load the old URL in a private window. It should go straight to the new page in one hop, with no chain.
  5. Update your menus and the internal links that use the old address.

Don’t point old URLs at the homepage. Google’s site move guidance says redirects to irrelevant pages may be treated as soft 404s. If nothing replaces the old page, a useful 404 page is the honest answer.

Changing the whole permalink structure is a much bigger job. In a Rank Math support thread, a user switched structures and found old links sent to the homepage. Support explained that the plugin’s auto-redirect covers changes to individual slugs, not structure changes, and pointed to the Permalink Migration option in the Redirection plugin. On an established site, plan per-URL redirects before you touch that setting.

If you would rather not do this by hand, SiteSelf can make the slug change, add the 301 and fetch the old URL to confirm it lands on the new page, all from a chat request. That is part of its WordPress SEO and redirect work.

Do slugs help SEO?

A little, mostly through clarity. Google’s URL structure guidelines ask for simple, readable URLs, hyphens rather than underscores, and words in your audience’s language. A slug like /wedding-photography/ tells a searcher what is behind the link before they click.

No source we found measures a ranking gain from the words in a slug. Yoast suggests three to five words, roughly 30 to 50 characters. That is editorial advice, not a measured threshold. Use the main term if it fits naturally, keep the slug close to the page’s title, and stop there.

The bigger SEO risk is breaking URLs, not choosing imperfect ones. Rewording a working slug to squeeze in a keyword trades a known-good URL for a redirect and a recrawl. Our guide on how to do SEO on WordPress puts slugs alongside the titles, links and content work that make more difference.

If one old URL is broken, it is missing a redirect. If many pretty URLs break at once, the cause is usually routing. WordPress’s common errors handbook gives the order to work in:

  1. Stale rewrite rules. Open Settings > Permalinks and click Save Changes without changing anything. That rebuilds the rules.
  2. Server rewrite support. On Apache, pretty permalinks need mod_rewrite and a correct .htaccess file. If saving does nothing, ask your host to check both.
  3. Name collisions. A custom post type with the same name as a page causes 404s. Rename the page and its slug, save the structure as Plain, then switch back to your preferred structure and save again.
  4. Plugin rewrite rules. In one WordPress.org report, a links plugin broke every two-segment URL on a site. Saving permalinks did not help, and deactivating the plugin did.

Saving permalinks again and again will not fix a real collision. Once the save has failed and the host has checked the server, deactivate plugins one at a time on a staging copy. If the cause still won’t show, get a developer.

WooCommerce product permalinks settings with product and category slug bases
Configuring distinct URL structures for product categories and individual products prevents base collisions that trigger unexpected 404 errors. · Source: premmerce.com

Frequently asked questions

Can a post and a page have the same slug?

The text can match when the full URLs differ, for example when posts use a date-based structure. Under the Post name structure both would want the same address, so WordPress adds a number to one of them. Pages and custom post types that share a path can also collide and return 404s.

Is there a maximum slug length?

No official limit is documented for everyday use, and we would not trust anecdotal numbers. Long slugs are hard to read and share, so keep yours to the few words that describe the page.

Which permalink structure should I choose?

Most practitioners recommend Post name, set before you publish real content. Avoid Plain, which gives URLs like ?p=123. If the site already has traffic, keep the structure you have unless you have a redirect plan for every URL.

Can I change an author slug?

Not from the standard profile screen. The author slug is stored separately from the display name, and changing it needs a plugin or code. Changing it moves the author archive URL, so redirect the old one.

Does a descriptive slug help accessibility?

Not directly. WCAG’s link-purpose guidance is about link text, not URL format. A clear slug won’t fix a “click here” link, and accessible link text doesn’t need any particular slug.

Should I remove the /product-category/ base in WooCommerce?

Only if you understand the tradeoff. WooCommerce’s permalink docs say the product and category bases must not conflict, and removing the base raises the risk of collisions in large catalogs. If you shorten it, redirect the old category URLs.

Give your WordPress site its first task.

Connect the site you already have, add your agent to Slack or Telegram, and tell it what you need.

Connect your site

Start with 500 free credits. No credit card needed.