Open the editor for any post in WordPress and you’ll notice a short string sitting under the title, usually lowercase, usually separated by hyphens. That’s the slug, and it does more work than its plain appearance suggests. A slug is the URL-friendly identifier WordPress generates from your post, page, category, or tag title, and it’s what shows up in the address bar after your domain name. Get slugs right and your URLs read cleanly and rank a little better. Ignore them and you end up with addresses full of numbers, stray characters, or words that don’t match what the page is actually about.
This guide walks through what a slug actually is, how WordPress builds one automatically, where slugs show up across a site beyond just blog posts, and the practical editing habits that keep them useful instead of messy.
What Exactly Is a Slug?
Technically, a slug is the last segment of a URL, the part that uniquely identifies a specific piece of content. If your site is example.com and you publish a post titled “10 Tips for Better Sleep,” WordPress will typically generate the slug 10-tips-for-better-sleep, producing a URL like example.com/10-tips-for-better-sleep/.
A few defining traits of a proper slug:
- Lowercase by convention. WordPress automatically converts uppercase letters to lowercase when generating a slug, and mixed-case URLs are generally discouraged for consistency.
- Hyphen-separated, not space-separated. Spaces in URLs get encoded as
%20, which is ugly and error-prone, so WordPress swaps spaces for hyphens. - Stripped of special characters. Punctuation, apostrophes, and symbols like
&,?, or#either get removed or converted, since some of these characters carry special meaning in a URL. - Unique within its content type. WordPress won’t let two published posts share an identical slug; if you try, it appends a number (
-2,-3, and so on) to keep URLs unique.
Slugs exist for more than posts and pages. WordPress generates them for categories, tags, custom taxonomies, custom post types, and even user profile URLs in some configurations (like BuddyPress or BuddyBoss member directories, where each member’s profile slug is usually their username). Anywhere WordPress needs a stable, readable identifier in a URL, a slug is doing that job.
How WordPress Generates Slugs Automatically
When you save a draft or publish a new post, WordPress runs the title through its sanitize_title() function behind the scenes. This function:
- Converts the string to lowercase.
- Removes accented characters where possible, or transliterates them into plain ASCII equivalents.
- Strips out HTML tags, if any made it into the title field.
- Replaces whitespace and most punctuation with hyphens.
- Collapses multiple consecutive hyphens into a single hyphen.
- Trims leading and trailing hyphens.
This is why a title like “What’s the Best WordPress Plugin? (2026 Guide)” ends up as a slug like whats-the-best-wordpress-plugin-2026-guide. The apostrophe and question mark disappear, the parentheses go, and everything else collapses into hyphen-joined lowercase words.
The important thing to understand is that the slug is generated once, at the point of first save, and it does not automatically update if you change the title later. If you publish a post titled “Draft Post” and then rename it to “The Complete Guide to Container Gardening” a week later, the slug stays as draft-post unless you manually edit it. This is actually useful, not a bug, because it protects existing links from breaking every time you tweak a headline.
Where to Find and Edit a Slug
In the Post or Page Editor
In the block editor, the slug appears in the “Permalink” section of the document sidebar on the right side of the screen (you may need to click “Permalink” to expand it if it’s collapsed). Click the field and you can type a new slug directly. In the older Classic Editor, the slug shows up right under the title field as an editable link, with an “Edit” button next to the full URL preview.
Either way, the workflow is the same: type your replacement text, save or update the post, and the new slug takes effect immediately, assuming it’s unique.
Through Permalink Settings
Slugs are one piece of a larger system called permalinks, the overall URL structure WordPress uses across your site. You control the format under Settings > Permalinks in wp-admin. Common structures include:
- Plain:
example.com/?p=123, purely numeric, not recommended for SEO or readability. - Post name:
example.com/sample-post/, the slug alone, generally the best default for most sites. - Day and name:
example.com/2026/08/sample-post/, useful for time-sensitive content like news sites. - Custom structure: build your own using tags like
%postname%,%category%, and%year%.
Whichever structure you choose, the slug itself is what fills in the %postname% portion. Changing your permalink structure changes how the slug is presented in the URL, but it doesn’t change the slug’s actual text.
For Custom Post Types and Taxonomies
If you’re registering a custom post type in code (through a plugin or your theme’s functions.php), you define its slug explicitly using the rewrite argument in register_post_type():
register_post_type('event', array(
'rewrite' => array('slug' => 'events'),
// other arguments...
));
This sets the base path for every entry of that post type, so an individual event might live at example.com/events/spring-conference/. The same pattern applies to custom taxonomies registered with register_taxonomy(), where the slug argument in the rewrite array controls the taxonomy’s base URL segment.
Why Slugs Matter for SEO and Usability
A well-formed slug does a few concrete jobs:
It gives search engines a readable signal. While URL slugs are a comparatively minor ranking factor next to content quality and backlinks, a slug that matches the page’s topic (best-espresso-machines rather than post-4471) reinforces relevance and can influence how the URL displays in search results.
It builds user trust. When someone hovers over a link or glances at a shared URL before clicking, a clear slug tells them what to expect. Compare example.com/blog/how-to-fix-slow-wordpress-site/ against example.com/?p=8842, one earns a click with almost no effort, the other gives nothing away.
It keeps URLs shareable and memorable. Short, descriptive slugs are easier to type, easier to remember, and less likely to break when copied into an email or chat message where long strings sometimes get mangled by line wraps or auto-linking.
It supports a clean site architecture. Consistent slug conventions across categories and post types (for example, keeping category slugs singular or always lowercase) make a site’s URL structure predictable, which helps both visitors and crawlers understand how content is organized.
Common Slug Mistakes and How to Avoid Them
Leaving slugs at their default when the title changes dramatically. If you rewrite a headline from something vague to something specific, take thirty seconds to update the slug too, provided the post hasn’t been live long enough to accumulate backlinks or search traffic under the old URL.
Stuffing keywords into the slug. A slug like best-wordpress-plugin-top-wordpress-plugins-2026-review-guide reads as spam to both users and search engines. Shorter, natural phrasing wins, aim for the core topic in as few words as make sense.
Changing a slug on a page that’s already ranking or linked externally. Editing a live slug breaks the old URL unless you set up a redirect. If a page has existing traffic, backlinks, or bookmarks, changing its slug without a 301 redirect in place will cost you that equity and hand visitors a 404 error instead.
Using stop words unnecessarily. Words like “a,” “the,” “and,” and “of” rarely add value in a slug and just make it longer. WordPress won’t strip these automatically, so it’s worth trimming them by hand when you edit a slug manually.
Slug Examples Across Content Types
| Content Type | Example Title | Resulting Slug | Example URL |
|---|---|---|---|
| Post | Introduction to Slugs | introduction-to-slugs | example.com/introduction-to-slugs/ |
| Page | Contact Us | contact-us | example.com/contact-us/ |
| Category | Web Design | web-design | example.com/category/web-design/ |
| Custom Post Type | Spring Conference (Event) | spring-conference | example.com/events/spring-conference/ |
Slug, Permalink, and URL: Untangling the Terms
People use “slug,” “permalink,” and “URL” almost interchangeably, and that looseness causes confusion when you’re troubleshooting a broken link or reading a plugin’s documentation. It’s worth pulling the three apart.
The URL is the full address, everything from https:// through the final character. The permalink is WordPress’s term for the permanent, structural pattern that URL follows, the rule that says “posts live at domain plus post name plus trailing slash,” for instance. The slug is just the one variable piece inside that pattern, the specific identifier for a specific piece of content. Change your permalink structure in Settings and every URL on the site reshuffles around the existing slugs. Change a single slug and only that one URL changes, the structure around it stays the same.
Plugins that talk about “custom permalinks” are usually really talking about slug editing, since the site-wide structure is a single setting but the slug is what you’re adjusting post by post.
Slugs in Community and Membership Sites
If your site runs BuddyPress or a theme built around it, like BuddyX, slugs extend beyond posts and pages into an area a lot of site owners don’t think about until they hit a conflict: member profile URLs, group URLs, and activity directory paths. A BuddyPress member’s profile typically lives at a URL built from their username slug, something like example.com/members/jane-doe/, and groups follow the same pattern under a groups base. These base paths (members, groups, activity) are themselves configurable slugs, set under Settings > BuddyPress > Options or in the component settings, depending on your BuddyPress version.
This matters practically in two ways. First, if a member’s display name changes, their profile slug generally doesn’t update automatically, similar to how a post’s slug won’t follow a retitled headline, so their profile URL can end up mismatched with their current display name unless an admin or the member edits it directly. Second, on a community site with thousands of members, slug collisions (two people who’d naturally generate the same username-based slug) are handled by WordPress and BuddyPress appending a number, the same fallback behavior used for duplicate post slugs.
Handling Non-Latin Characters and International Slugs
WordPress’s slug sanitization was originally built with Latin-alphabet titles in mind, and for languages that don’t use Latin characters (Arabic, Japanese, Russian, and similar), the default behavior historically stripped non-Latin characters out entirely, sometimes leaving an empty or near-empty slug that WordPress would then fill with the post ID as a fallback.
Modern WordPress versions handle this more gracefully by URL-encoding non-Latin characters instead of deleting them, which preserves the original title’s meaning in the slug even if it doesn’t render as readable Latin text in the address bar. If your site serves non-English content and you want cleaner, transliterated slugs (Latin characters that approximate the original pronunciation, common in French, German, and other accented-Latin languages), plugins built for multilingual SEO typically include a transliteration option so that “café” becomes “cafe” rather than an encoded string. Worth checking that setting specifically if you’re publishing in a language WordPress doesn’t fully transliterate by default.
What Happens to a Slug When You Trash or Restore a Post
Moving a post to Trash doesn’t free up its slug for immediate reuse. WordPress appends __trashed to the slug of a trashed post specifically so a new post with the same title can be published without a naming conflict while the old one sits in Trash. If you then permanently delete the trashed post, or restore it, the slug situation resolves: restoring gives it back the original slug (assuming nothing else has claimed it in the meantime), and permanent deletion frees the slug entirely.
This trips people up occasionally: they trash an old post, immediately try to republish a new one under the identical slug, and find WordPress adds a -2 suffix because the trashed original is still technically holding onto a variant of that slug in the database. Emptying Trash first solves it.
Redirects: The Missing Half of Slug Editing
Everything above about not breaking live URLs comes down to one piece of infrastructure: the 301 redirect. If you must change a slug on a page that already has inbound links, search rankings, or bookmarks pointing at it, pair the change with a redirect from the old URL to the new one. A 301 tells browsers and search engines “this content has permanently moved here,” passing along the accumulated SEO value instead of just handing visitors a dead link.
Most SEO plugins (Yoast SEO, Rank Math, All in One SEO) include a redirect manager, or you can use a dedicated redirection plugin if you’re not running one of those suites. Either way, treat the redirect as a required step, not an optional cleanup task, whenever you touch the slug on anything with existing traffic.
Frequently Asked Questions
Can two pages on the same WordPress site share a slug?
Not within the same post type. WordPress enforces uniqueness among posts, and separately among pages, so you generally can’t have two published posts both using about-us. However, a post and a page can sometimes share an identical slug because they’re tracked separately, though this is worth avoiding since it can create ambiguous URLs depending on your permalink structure.
Does changing my permalink structure change my existing slugs?
No. The permalink structure controls how slugs are arranged and displayed within a URL, but the slug text itself, the actual word or phrase, stays the same regardless of which structure you pick in Settings > Permalinks.
Is there a maximum length for a slug?
WordPress technically allows fairly long slugs at the database level, but from a practical standpoint, most SEO guidance recommends keeping slugs short and focused, generally well under 75-100 characters, since shorter URLs tend to display more cleanly in search results and are easier for people to read and share.
Why did WordPress add a number to the end of my slug?
This happens automatically when the slug you’re trying to use is already taken by another post, page, or (depending on context) a trashed item still holding that slug. WordPress appends -2, -3, and so on to guarantee uniqueness rather than blocking you outright.
Can I use underscores instead of hyphens in a slug?
You can manually type an underscore into a custom slug, but it’s not recommended. Search engines historically treat hyphens as word separators and underscores as word-joiners, meaning “best_wordpress_plugin” may be read as a single long token rather than three separate words, which works against you for both readability and search relevance.
Should I include dates in my slug?
Generally no, unless your permalink structure already embeds the date elsewhere and the content is genuinely time-bound (an annual event recap, for example). Baking a year into a slug like best-plugins-2024 means the URL itself starts to look outdated once that year passes, even if you keep the content current with periodic updates. A dateless slug like best-plugins ages better and lets you refresh the page’s content indefinitely without the URL contradicting it.
A Quick Checklist Before You Publish
- Does the slug describe the actual topic in a handful of words?
- Is it lowercase and hyphen-separated, with no stray underscores or symbols?
- Have you removed unnecessary stop words and filler?
- If you’re editing a slug on a page that’s already live and indexed, have you set up a redirect from the old URL?
- Does it match, or at least closely echo, your target keyword without stuffing?
Slugs are a small detail in the day-to-day work of running a WordPress site, but they compound. A site with hundreds of posts and consistently thoughtful slugs reads as more organized and more trustworthy than one where every URL is a random string of numbers. WordPress handles the basic generation for you automatically, but a few seconds spent reviewing and adjusting each slug before you hit publish is one of the cheapest habits you can build into your workflow.
Interesting Reads:
How To Develop a WordPress Site