Skip to main content
Blog|
How-to guides

How to change the WordPress URL slug

|
Apr 27, 2026|13 min read
HOW-TO GUIDESHow to change the WordPressURL slugHOSTNEYhostney.comApril 27, 2026

Short answer: open the post or page in the block editor, click anywhere in the document, then open the Document panel on the right and edit the URL (or Permalink) field. That value is the slug, the last segment of the URL. Save the post and WordPress updates the URL immediately. If the post is already published with traffic or backlinks pointing at it, set up a 301 redirect from the old URL to the new one before you save, or rankings and inbound links will break.

The rest of this guide covers what a slug actually is, what characters are safe to use, where the slug field lives in the modern editor versus the classic editor, how to bulk-edit slugs, the redirect rules that protect SEO when you rename a published URL, the difference between a post slug and the global permalink structure, and what to do about the awkward ?s= search URL.

What is a slug#

A slug is the human-readable, URL-safe identifier for one piece of WordPress content. In a URL like https://example.com/wordpress-themes-explained/ , the slug is wordpress-themes-explained . WordPress generates one automatically from the post title when you first save, then stores it in the post_name column of the wp_posts table.

Every post, page, category, tag, custom post type entry, author archive, and attachment has a slug. Each is editable from the WordPress admin (some require a plugin or code for full control, more on that below).

Slugs feed into the URL through whatever permalink structure your site uses. If your site is on the recommended Post name structure, the slug is the URL. If you use a dated or category-prefixed structure, the slug is the last segment of it. The full rules for that template live in WordPress permalinks: how to configure them for SEO. This article focuses on the per-post slug, not the site-wide structure.

Where the slug field is in the block editor#

In the block editor (Gutenberg, the default since WordPress 5.0), the slug lives in the document sidebar.

  1. Open the post or page for editing.
  2. Make sure the Settings panel is open (the gear icon, top right).
  3. Click Post (or Page) at the top of the sidebar to switch from block settings to document settings.
  4. Look for the URL section, or in older WordPress versions, the Permalink section.
  5. Click the URL to open the slug field, edit it, and click outside the field to confirm.

The change does not save to the database until you click Update on the post itself. If you change the slug and then click out of the post without saving, the change is discarded.

A subtle quirk: until you click Publish or Update the first time, WordPress hides the URL field and shows only a placeholder. The slug is generated from the title at publish time, so you can preview the URL before publishing only by manually saving a draft first. Save the draft, then the URL section appears with an editable slug.

Where the slug field is in the classic editor#

If your site still uses the classic editor (via the Classic Editor plugin or an older theme/admin setup), the slug field is in a different place but works the same way.

  1. Open the post or page for editing.
  2. Below the title bar, you see the full permalink: https://example.com/sample-post/ Edit .
  3. Click the Edit button next to the URL.
  4. The slug becomes an editable text field. Change it, click OK, then Update the post.

The classic editor shows the slug field immediately, even before you publish. That is one of the few places where the classic flow is more convenient than Gutenberg.

URL-safe characters#

WordPress sanitizes slugs automatically, but it pays to know the rules so you can predict what your edited slug will become.

Allowed: lowercase letters (a-z), digits (0-9), and hyphens ( - ).

Auto-converted:

  • Uppercase letters become lowercase.
  • Spaces become hyphens.
  • Accented characters get transliterated when possible ( café becomes cafe ).
  • Underscores are technically allowed but converted to hyphens by sanitize_title() in most modern setups.

Stripped or replaced:

  • Punctuation: ? , ! , , , ; , : , ' , " , parentheses, brackets, slashes – all removed.
  • Symbols: @ , # , $ , % , & , * – all removed.
  • Multiple consecutive hyphens collapse into one.
  • Leading and trailing hyphens are trimmed.

So if you type My New Blog Post! (2026) , WordPress saves it as my-new-blog-post-2026 . The behavior is consistent and you cannot bypass it through the admin UI – the sanitization runs server-side every time the slug is saved.

Non-Latin characters are a special case. WordPress can store UTF-8 in the post_name column, so URLs like /привет-мир/ or /日本語/ work in the database. Whether they display as readable characters or percent-encoded escape sequences ( /%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82-%D0%BC%D0%B8%D1%80/ ) in browsers depends on the browser and the user. Most modern browsers show them readably. Search engines handle them correctly. The downside is sharing – copying a percent-encoded URL into a chat or email looks ugly.

If your audience is global and not specifically tied to a non-Latin script, transliterate to ASCII for cleaner URLs.

Slug length and SEO#

There is no hard rule on slug length, but shorter is better for two reasons. First, search engines display only the first 60-70 characters of a URL in results, so anything past that is invisible to people scanning the SERP. Second, short URLs are easier to share, easier to remember, and look less spammy in social previews.

A useful rule of thumb: 3-5 words. Use the target keyword and skip filler.

Bad: the-complete-guide-to-changing-the-url-slug-in-wordpress-for-seo-purposes

Good: change-wordpress-url-slug

Better still, drop redundant words that the URL context already implies. If the article is on a WordPress blog, the URL does not need wordpress in it again. change-url-slug may be enough.

This is also where slugs differ from titles. Titles can be long and descriptive because they appear as the headline in browser tabs, social cards, and search results. The slug is the URL, and URLs benefit from being terse.

For more on how titles and slugs interact in search, see the WordPress SEO beginner’s guide.

Changing the slug on a published post#

This is where slugs get dangerous. Changing the slug on a published post breaks every existing link unless you set up a redirect.

Imagine a post has been live for a year at /setting-up-wordpress/ . It has 40 inbound links from other sites, 200 social shares, an entry in Google’s index that ranks for several queries, and a backlink in your email newsletter from six months ago. You decide to rename it to /wordpress-installation-guide/ because the new slug matches the keyword you actually rank for.

The moment you save:

  • The old URL returns 404.
  • Every backlink from other sites now points to a broken page.
  • Google’s indexed entry returns 404 on the next crawl and the page eventually drops out of search results.
  • People who bookmarked or shared the old URL hit a dead end.
  • Internal links from your own posts that hardcode the old URL break.

The fix is a 301 permanent redirect from the old URL to the new one. A 301 tells search engines “this content has moved permanently, transfer the ranking signals to the new URL.” With the redirect in place, inbound links keep working, search engines update the index without a ranking drop, and visitors land on the right page.

Setting up the redirect

The fastest path is a redirection plugin. Install Redirection, Rank Math (free), or Yoast Premium, then add a rule: source /old-slug/ , destination /new-slug/ , type 301. The plugin handles the rest.

If you do not want another plugin, you can add the redirect at the web server level. On Nginx:

rewrite ^/old-slug/?$ /new-slug/ permanent;

On Apache, in .htaccess :

Redirect 301 /old-slug/ /new-slug/

Web server rules are faster than plugin-based redirects because they run before WordPress loads, but they require server access. On managed hosts where you cannot edit the server config, the plugin route is the only option.

Test the redirect with a handful of old URLs before relying on it. Pay attention to trailing slashes – WordPress usually enforces them, and a redirect that drops the slash can create a redirect loop.

When to skip the redirect

The only safe time to change a slug without a redirect is on a brand new draft that has never been published, never been shared, and never been indexed. WordPress shows you a “View Post” link as soon as you save a draft, so even an unpublished post can have outside traffic if you sent the link to anyone. When in doubt, set up the redirect.

Bulk-editing slugs#

WordPress’s built-in bulk-edit (Posts > All Posts, select multiple, choose Edit from Bulk Actions) does not include the slug field. You can bulk-edit categories, tags, status, and a few other fields, but not slugs.

For bulk slug changes you have three options:

Quick Edit, one at a time. From the Posts list, hover a row and click Quick Edit. The slug appears as an editable field. This is fine for a handful of posts but tedious for dozens.

WP-CLI. If you have shell access:

wp post update 123 --post_name=new-slug

You can script this in a shell loop or pull post IDs from a wp post list query and run the update across many posts at once.

Search-and-replace plugin. Plugins like Better Search Replace can replace one string with another across the entire database, but use this with care – it operates on raw text, so you can corrupt serialized data if you replace something that appears in a serialized field. For slug-only changes, the safer path is the WP-CLI route, which only touches the post_name column.

Whichever method you use, set up redirects from the old URLs first. Bulk slug renames without redirects are how sites lose their rankings overnight.

These three terms get used interchangeably and that causes confusion when reading WordPress documentation. The distinction matters when you are debugging a URL problem.

Permalink is the full, permanent URL of a piece of content: https://example.com/category/sample-post/ .

Permalink structure is the template that WordPress uses to generate every permalink on the site: /%postname%/ , /%category%/%postname%/ , and so on. You set the structure once in Settings > Permalinks and it applies site-wide.

Slug is the per-post identifier that WordPress slots into the structure: sample-post in the example above. Each post has its own slug, editable per post.

So when someone says “I changed the permalink and now my post is broken,” the question is which one – the global structure or the per-post slug? They have very different fix paths. Changing the structure breaks every URL on the site (covered in the permalinks guide). Changing one slug breaks only that one URL.

Category, tag, and author slugs#

Posts and pages are not the only things with slugs.

Category slugs are edited at Posts > Categories. Click the category name (or hover and click Edit), and the slug field appears below the name. Changing a category slug changes every URL under /category/<slug>/ if you use the default category base. The same redirect rules apply – 301 from the old slug URL to the new one. The categories management guide covers this in detail.

Tag slugs are at Posts > Tags and behave the same way.

Author slugs are tied to the user’s nicename in the database. Edit them under Users > Profile (look for the URL or Profile section), or via a plugin like Edit Author Slug, which adds a dedicated field on the user profile page. Changing an author slug changes every author archive URL.

Custom post type slugs are set in code by the plugin or theme that registers the post type, using the rewrite argument on register_post_type() . WooCommerce products use /product/<slug>/ by default, configurable under Settings > Permalinks > Product permalinks. After changing custom post type slugs, go to Settings > Permalinks and click Save to flush the rewrite rules – that is the same flush trick described in the permalinks guide.

WordPress’s built-in search results page lives at a query-string URL: https://example.com/?s=keyword . This is technically a slug-less URL, but people often want to clean it up.

The only built-in way to influence the search URL is by adding a custom rewrite rule. Add this to your theme’s functions.php or a small custom plugin:

function custom_search_rewrite() {
    add_rewrite_rule('^search/(.+)/?$', 'index.php?s=$matches[1]', 'top');
}
add_action('init', 'custom_search_rewrite');

function redirect_search_url() {
    if (is_search() && !empty($_GET['s'])) {
        wp_redirect(home_url('/search/' . urlencode(get_query_var('s')) . '/'));
        exit;
    }
}
add_action('template_redirect', 'redirect_search_url');

The first function adds a rewrite rule so /search/keyword/ resolves to a search query. The second redirects ?s=keyword URLs to the cleaner /search/keyword/ form. After adding the code, go to Settings > Permalinks and click Save to flush the rewrite rules.

Most SEO and search-replacement plugins (SearchWP, Ivory Search, Relevanssi) include this URL rewrite as an option in their settings. If you are already using one of those plugins, check its options before writing custom code.

Common mistakes#

Renaming the slug right before a launch. Sites get hard-launched with the wrong slug because someone edited it in the last save without telling anyone. If your team has a publishing workflow, lock down slug edits after sign-off.

Forgetting redirects. Single most common cause of “we lost rankings on this post.” The redirect is one line of plugin config or one line of Nginx config. Always do it.

Letting WordPress auto-generate slugs from very long titles. A title like “How to Set Up WordPress on a Cheap Shared Host in 2026 Without Losing Your Mind” produces a 75-character slug. Edit the slug down to something shorter before publishing.

Using slugs that conflict with WordPress reserved paths. Slugs like wp-admin , wp-login , feed , comments , author , tag , category , page interact with built-in WordPress URLs and can cause routing conflicts. WordPress will usually let you set them anyway and then complain when something breaks. If you see a 404 or unexpected behavior on a specific post, check whether the slug collides with a reserved path.

Changing a slug to “fix” SEO without measuring first. Slugs are a weak ranking signal compared to content quality, internal linking, and authority. Renaming /wordpress-tutorial/ to /wordpress-tutorial-for-beginners/ is unlikely to move the needle by itself, and it carries the risk of botched redirects. If you change a slug, do it because the new one is meaningfully better, not as a speculative tweak.

Confusing slugs with excerpts or meta descriptions. Each is a separate field and they serve different purposes. The slug is the URL, the excerpt is the post summary, the meta description is the snippet shown in search results.

How Hostney handles slug changes#

When you save a post on Hostney with a changed slug, the platform purges the cached HTML for that post automatically, so visitors hitting the new URL see the new content immediately rather than a stale 404 from cache. The same automatic purge runs for the post archive, the homepage, and any tag or category page that listed the old URL, so internal listing pages update on the next request without a manual cache flush.

For redirect handling, use one of the standard WordPress redirect plugins (Redirection, Rank Math, Yoast Premium). The platform does not interfere with plugin-based redirects, and the Hostney edge serves the redirect response with the same cache benefits as any other 301.

Summary#

The slug is the per-post URL identifier, edited in the URL field of the block editor’s document sidebar (or the Edit Permalink button in the classic editor). WordPress sanitizes it to lowercase letters, digits, and hyphens. Keep slugs short, descriptive, and locked down once published.

If you have to rename a published post’s slug, set up a 301 redirect from the old URL to the new one first. Do that with a redirection plugin or a single web server rewrite rule. Without the redirect, every inbound link breaks and rankings drop.

The slug is one piece of the URL puzzle – the global permalink structure, category bases, and custom post type rewrites all interact. If you are setting up URLs for the first time on a new site, start with the permalinks guide and pick the structure first, then worry about individual slugs after.