Slug

A slug is a URL friendly text string representing a post, page, tag or category, usually constructed from the title of the content it represents. For instance, if you create a post called ”Hello World!”, WordPress will automatically give it the slug ”hello-world”. If you publish that post and view it, the address bar in your browser will probably include the slug as part of the posts URL. Since the slug must be URL friendly, special characters (like spaces or most forms of punctuation) are automatically replaced or removed from the slug. The exact structure of the post URL depends on your permalink settings. The default permalink structure is www.website.com/2018/08/30/hello-world/ for posts, and www.website.com/hello-world/ for pages.

In some cases, you might want to make adjustments to the slug WordPress generated for you. If your post has a long title, for instance, you might want to adjust the slug to be a bit shorter, or to include more relevant keywords to improve the search engine optimization of the post. You can do so by going to Posts → All Posts (or Pages → All Pages), and clicking the title of the post you want to edit. The permalink of the post, which contains the slug, is displayed directly below the title field. Click the ”Edit” button next to it, update the slug as you see fit, and click the ”Ok” button. Next, click the blue ”Update” button (or ”Publish”, if it’s a new post) to save your changes.

Note: If the existing URL for the post already has links pointing to it, those links might break when you update the slug. If that is the case, you’d probably be better off leaving the existing slug as it is.

If WordPress automatically appends a number to the end of your slug (resulting in ”hello-world-2”, for example), then that’s because the slug is already used by another post on your site. WordPress appends the number to ensure that the URL is unique. To fix this, either use a different slug on the post you’re adding, or locate the old post with that slug and change it to something else.

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.