How to Remove Numbers from WordPress URLs

200

Recently one of our readers emailed us asking the question how to get rid of numbers from WordPress post and page URLs. By default, WordPress uses post IDs (numbers) instead of pretty keyword text in the URLs. This is bad for SEO. In other cases, WordPress will add a -2 in front of your post, page, category, or tag URLs which simply looks bad in front of users. In this article, we will show you how to get rid of numbers from WordPress URLs.

Video Tutorial

 

Subscribe to WPBeginner

If you don’t like the video or need more instructions, then continue reading.

Permalink URL Structure

WordPress has built in support for SEO friendly URL structure. All you need to do is to open Settings » Permalinks page in the admin area and choose a URL structure for your site. There are a number of options available. We recommend choosing a URL structure that shows your post title in the URL because it is SEO friendly and will help others discover your site in search engines. Once you have setup permalinks you need to save your changes.

Setting up permalinks in WordPress

WordPress will now automatically change URLs for all your previous posts as well. Don’t worry if you have posted the older URLs somewhere because WordPress will automatically redirect those users to new URLs.

Custom Slug

Even though you are using Pretty Permalinks now, you may still want to get rid of numbers in your post URL. The most common reason for this is when you are publishing a post that has no title.

Remember, WordPress chooses the text to display in URL from your post’s title, so if your post does not have a title, then WordPress will use the post’s ID in the URL. You can manually tell WordPress what to use in the URL instead of the post number.

Just below the post title, you will see your post’s URL with an Edit button next to it. Clicking on the edit button will make the URL editable. This editable part is called post-slug. You can enter the text you want to use as post slug in the URL.

Note: you can only add letters, numbers, and dashes in the URL slug.

Editing post slug in WordPress

Duplicate Posts and Pages

Sometimes even when you edit the custom slug, the -2 continues to be added in your URLs. For example you create a new about page, and your URL looks like this:

http://yoursite.com/about-2/

Now wouldn’t you want to get rid of that -2, and simply have it as /about/. This problem occurs when you have the same slug being used already.

Check all your posts and pages to see that there is none that has the same slug (i.e /about/). If you find one, then you need to delete it unless you’re using it. More often than not, you won’t find an active page with the same slug.

This is when you need to look in the Trash folder. When you trash a WordPress post or page, it is not entirely deleted. It sits in the trash for 30 days before it gets permanently deleted. This is done to give you an option to restore trashed item if you accidentally deleted them.

As long as the post or page stays in the trash, the slug cannot be re-used. So if you want to re-use the /about/ slug, then you must delete the About page sitting in the trash folder. Once you do that, you should be able to edit your slug like the method shown above and get rid of the -2.

This technique works for categories and tags as well.

We hope this article helped you get rid of numbers from WordPress URLs. For feedback and questions, you can leave your comments below or join us on Twitter and Google+