WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Beginners Guide» How to Remove Numbers from WordPress URLs

How to Remove Numbers from WordPress URLs

Last updated on December 2nd, 2014 by Editorial Staff
45 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Remove Numbers from WordPress URLs

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+

45 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

48 Comments

Leave a Reply
  1. Thomas says:
    Feb 13, 2020 at 12:34 am

    Hi,

    Thank you for a very informative video / article.

    I have the same issue that you talk about, where the “-2” appears on one of my sites, however, I have nothing in my trash?

    Currently, this issue arises on my local server and I would love to get it fixed before I take this live. Could you help me?

    Reply
    • WPBeginner Support says:
      Feb 13, 2020 at 8:50 am

      You would want to try to visit the URL without the -2 in it to see if it directs you to a page in which case you should be able to click the edit option in the admin bar at the top of your site. :)

      Reply
  2. pankaj says:
    Jan 2, 2020 at 3:58 am

    Awesome! :)

    Thankyou!

    Reply
    • WPBeginner Support says:
      Jan 2, 2020 at 10:35 am

      You’re welcome :)

      Reply
  3. Tamás says:
    Sep 25, 2019 at 12:37 pm

    Hello!

    I like to get WP to start the numbering on repeating slugs from 8 digits.

    E.g. sample-post, then sample-post-0000001

    Any idea? I don’t find anything related and would be extremeley important.

    Thx!

    Best
    Tamas

    Reply
    • WPBeginner Support says:
      Sep 26, 2019 at 10:32 am

      Sadly, at the moment we do not have a recommended method for setting that up.

      Reply
  4. Ajay says:
    Aug 11, 2019 at 12:32 pm

    Dear Editor,
    I have a question about how to remove tag from wordpress url?

    old url: site.com/tag/movies

    New Url : site.com/movies

    How do I do that in wordpress? And how do I make the url direct from the old url?

    Reply
    • WPBeginner Support says:
      Aug 12, 2019 at 9:35 am

      For the URLs, you would want to take a look at our guide here: https://www.wpbeginner.com/wp-tutorials/how-to-create-custom-permalinks-in-wordpress/
      After changing your URLs, you would want to create a redirect using one of the methods here:
      https://www.wpbeginner.com/beginners-guide/beginners-guide-to-creating-redirects-in-wordpress/

      Reply
  5. Bilal says:
    Feb 18, 2019 at 12:33 pm

    Today, when I working on Login page to place Password recover form short code, I Turn of Social media Login. After that I Logout Admin and checked that, two changes observed, one is Login form shwing very small size, second is all pages showing IDs when open in browser

    Now what I do to set it, in settings, Permalinks seting are ok like previous, what thing changed, which showing IDs after url.

    Any solution.

    Reply
    • WPBeginner Support says:
      Feb 19, 2019 at 10:59 am

      You would want to let the social media login plugin know what happened to the login form after disabling and they should be able to assist. If it is a ? followed by a number then you are likely using an ecommerce plugin that is tracking sessions so it can save the cart for the user.

      Reply
  6. Bita Gh says:
    Jun 17, 2018 at 1:52 am

    I have a problem in my wordpress website. my old website has been linked to my new website though an URL which I can not find. I want to delet or disable that link especially in google search. because that is linked to my old shop and old prices and people keep calling about the differences in prices. please help!

    Reply
  7. Janice Sullivan says:
    Mar 14, 2018 at 12:09 pm

    My links are ok but on the top bar I see “All Posts | “my link name”. ‘All post’ is not part of the name of the page/blog posts or in the link? I can’t figure out how to remove it…any help out there?

    Reply
  8. Adrian McCarthy says:
    Dec 8, 2017 at 2:46 pm

    Thank you, thats such a simple solution and works brilliantly thank you.

    Reply
  9. Sarah X says:
    Jun 27, 2017 at 12:07 pm

    Hello. I did what all the steps you did but the 2 continues to show up in the url. I dont know what to do . i deleted and add like 3 times the same page and that number still there … :s
    Whats wrong ? can you help me pls

    Appreciate the attention
    Sarah. from Portugal

    Reply
    • WPBeginner Support says:
      Jun 27, 2017 at 1:55 pm

      Hi Sarah,

      When you delete a post or page in WordPress, it goes into the trash. You need to delete that page from Trash as well. Go to Pages » All Pages and you will see a row of links to sort pages according to their status (Published, Draft, Scheduled, Trash). Click on the trash to view the pages that you have deleted earlier. Once you are there you will see a link ‘Delete Permanently’ below each article clicking on it will delete the page permanently and you will be able to use that slug for your new page.

      Reply
      • Kat Zimmer says:
        Jan 11, 2018 at 3:15 pm

        Hi there,
        I’ve combed through our site and taken all the actions you’ve suggested (permanently delete everything in the trash and ensure there is no photo/media file with that slug) and it’s STILL naming my slug with a -2 at the end. Please help!!

        Reply
        • WPBeginner Support says:
          Jan 16, 2018 at 10:24 am

          Hi Kat,

          Please check your pages and categories as well. Also try visiting the full url to see if there is a post, page, or attachment with the same slug.

    • Peter says:
      Jan 14, 2018 at 11:24 pm

      How can I produce a list of permalinks that have “-2” at their end, so I can correct them? I have 291 posts, 48 pages, and around 50 product pages.

      In addition, I have two ecommerce stores, one for Australia (/shop/bookname) and one USA (/books/bookname), and all products have permalinks. Doesn’t permalinks take notice of the rest of the URL?

      Thanks,
      Peter

      Reply
  10. Sarah says:
    May 9, 2017 at 9:14 am

    I deleted a post and when I went to make a new one the -2 is STILL there. Any other help?

    Reply
    • Shaikh says:
      Aug 16, 2017 at 9:43 am

      I didn’t have any pages still in trash. I didn’t have a category with the same name as my page. I didn’t have another page with the same name. So I did something crazy. WP was trying to name my page as page-2, so I went to mywebsite.com/page to see what happened.

      A page with a single photo popped up. I had a PHOTO with the same name as the page, and WP media manager gives photos permalinks based on the file name! Fix was to rename the photo (still keeping SEO in mind), and using the permalink editor for the page. TAH DAH! Like magic, it worked

      Reply
      • Chrissy says:
        Sep 25, 2017 at 3:21 pm

        Ah, I was pulling my hair out with this and what you’ve found out has solved my issue. Thanks for posting your findings, very helpful…

        Reply
  11. Janssen says:
    Mar 31, 2017 at 8:44 pm

    is there any way to also hide the url link? for example, mysite/mypost/ instead of 192.168.0.1:8080/mypost/

    Reply
  12. Christa says:
    Nov 13, 2016 at 9:40 am

    I found your post because I do wonder about the following number behind all the pages and posts I have on my website which then looks like this: example.com/?v=b9610cde4c4c.
    If I check the number only with google there comes my site with two pages and another very strange facebook website kind of….
    I saw that someone commenting did find out about a plugin – so I deactivated all social plugins, I haven’t got hers on my site. The Permalinks are checked and correct and I didn’t find anything to change or this number, in my php. Do you have any Idea, what this could be or must I worry…?

    Reply
    • WPBeginner Support says:
      Nov 13, 2016 at 11:05 pm

      If you are worried about security of your site, then you can try scanning your website with Sucuri. If the URLs are getting indexed in search, then it is not good for your website’s SEO.

      Reply
      • Christa says:
        Nov 14, 2016 at 12:46 pm

        Hello, thanks for your reply and yes, I will check it at sucuri – good idea! I don’t understand what you mean by “if the URL’s are getting indedexed in search…” what do you mean by that?
        Thank You!

        Reply
  13. Richard says:
    Sep 9, 2016 at 5:53 am

    I Once Had The Problem Of Seeing the -2 slug being shown for duplicate pages left in trash. However with a New Site I was Editing I was Still Having the -2 show up in title but there was not anything in my Trash For Pages. I Finally Searched My domain with the correct title I wanted and Up Popped one Of the images in my IMAGE Library that had the same name of the page I kept trying to correct. So Images with Names the same as your titles will cause this Behavior too. Just My Experience with the problem.

    Reply
    • WPBeginner Support says:
      Sep 9, 2016 at 10:34 pm

      Images are also stored as attachment which is a built in WordPress post type. Like all other post types attachments also have slugs. So yes if you have an attachment with slug my-first-bike and then you try to add an article with the same slug, then WordPress will add a number to the slug.

      Reply
  14. trey says:
    Sep 7, 2016 at 4:47 pm

    Had the same problem on a page. Deactivated all plugins, quick edit of page url. and bingo it now works, tried everything to no avail before!

    Reply
  15. Paul Sadler says:
    May 3, 2016 at 11:50 pm

    Unfortunately, this article is a bit simplistic as that is not always what causes the -2 to be added. While it will do it if there is already an “about” and you are adding another page or post called “about”, but it also has problems with numbers as the titles of pages.

    I am creating a gallery and some of the layout is a bit manual for organization, partly as I am wrapping text around the intro and conclusion. So I called one of the pages 2015, another 2010, another 2016. Doesn’t matter what I call it, there is nothing in my trash by that name, it is entirely “new”, but WP will NOT allow it. Why? Because it knows it looks like a year and it doesn’t like numbers only in the structure.

    So I can’t have “2015 / January” as my structure, it will have to have some other letter in there for the year plus of course I can’t have the “January” page every year, leaving me with a URL that will look like Y2015 / 2015-January…not very elegant I’m afraid, but seems to be the only solution other than running a custom plugin that overwrites the slugs and risks breaking all of the WP install.

    Paul

    Reply
  16. Chirag Gupta says:
    Apr 29, 2016 at 1:03 am

    how can i remove category or tag from url…
    example.com/category/mobile >>> example.com/mobile

    Reply
    • WPBeginner Support says:
      May 1, 2016 at 6:12 pm

      See our guide how to change category base prefix in WordPress.

      Reply
  17. andrew says:
    Aug 28, 2015 at 4:55 pm

    I seem to no longer be able to add a permalink with just four digits (ie “http://example.com/1223”)
    You used to be allowed to do this for posts but not pages, now you can’t do it at all and it is really messing up one of my clients sites.

    Reply
  18. Devang Sharma says:
    Jun 24, 2015 at 5:31 am

    Thank You very much guyz ! You don’t know how disturb i was…..

    Reply
  19. Damaris says:
    Jan 31, 2015 at 10:33 pm

    How do you change it if you have wordpress beginner?

    Reply
  20. WPBeginner Staff says:
    Sep 21, 2014 at 1:00 am

    This is unusual behavior. Please deactivate all your WordPress plugins and switch to a default theme like twenty thirteen or twenty fourteen. See if your posts still have links like this. If they do then it is likely that your WordPress security is compromised.

    Reply
  21. Karon Warren says:
    Sep 20, 2014 at 11:29 am

    I have permalinks set up on my site with “post name” as the default setting. And that does work. However, when you actually click on the live post, it initially comes up with the permalink, but after fully loading, it has a series of numbers/letters attached to the permalink, like this: #.VB2dTCtdVW0
    How do I get rid of those numbers from the actual permalink?

    Reply
    • Janet Bauske says:
      Oct 4, 2014 at 7:19 pm

      Karon, I had the same problem. I found the culprit was the AddThis social bookmarking widget. To remove it, go to the Plugin settings under Settings > AddThis Share > Advanced Tab and turn off the Address Bar Shares Tracking.

      Reply
  22. Cathy Sirvatka says:
    Sep 9, 2014 at 2:50 am

    I have been trying to figure out the number thing for a long time. Thank you for this!! I had no idea files in the trash were still using the page name!

    Reply
  23. Steve says:
    Aug 3, 2014 at 8:54 am

    I have the same problem (-2 at the end). I have cleared my trash, etc but I’m still having the same problem. I have an about-2 page, but no sign of an about page. Any ideas?

    Reply
  24. Rugby says:
    Jun 18, 2014 at 9:07 am

    Really helpful – had problem with -2 being added to my posts page and emptied trash and hey presto gone! Thanks

    Reply
  25. Theresa says:
    May 6, 2014 at 10:07 pm

    sometimes the littlest things can feel like a stalemate. thanks for providing all these great tips

    Reply
    • Michael Monday says:
      May 14, 2014 at 9:21 am

      Splendid !!! You just said it all !!! Thanks a lot for this long-sought solution to the “urgly” url I have had to deal with for months. Now my posts url looks good. Thanks a lot My Balkhi and your team :)

      Reply
  26. John says:
    Mar 10, 2014 at 5:45 pm

    This is all great information! I would like to know if I can use some of what I find here to post on my site, or include in email campaigns. Specifically, referring to the badge in this post for removing numbers from urls in WP, but also would like to know if there are others available, within the confines of best practices of course.
    thanks,
    jag

    Reply
  27. Keith Davis says:
    Mar 10, 2014 at 1:31 pm

    Hi Guys
    I’ve got pretty permalinks set so I’ve had no problems with that but I have had the 2 appear in a couple of posts.

    The first time I trashed a post and started again not realising that trashing is not enough: you have to delete it.

    The second time I trashed and deleted the post but still got the dreaded 2 at the end.

    No idea why that would happen.

    Reply
  28. Gretchen Louise says:
    Mar 10, 2014 at 12:49 pm

    Is the automatic redirection of permalink styles a new feature? I still use custom .htaccess code but have had issues with it eliminating my date-based archives, too.

    Reply
  29. patty jones says:
    Mar 10, 2014 at 12:41 pm

    WordPress automatically redirects to the new permalinks? I have wanted to change the permalink structure of my site for a long time but worried how it would affect links that are already out there.

    Our site has over 4000 posts and I figured it would kill our page rank. What are you thoughts on that many redirects?

    Reply
  30. jayism says:
    Mar 10, 2014 at 11:07 am

    This is an interesting post, but it does not cover how to remove the site.com/category-2/sub-category/heres-a-post.php – I have this problem, and read it happens when you create a category called software, then delete it, and create it again further down the track – the original ‘software’ remains in the DB for ‘categories’ – therefore it is forced to name the category with a -2 so the Database doesn’t have a duplicate….

    The only ways I’ve read to fix this in numerous posts is going into myPHPAdmin and deleting the original ‘software’ manually! Your post has shed some light on the situation, and may have another way to get rid of the -2 fro actual categories?

    Thanks,
    @jaycameron of ‘Crowd-Sourced Development Initiative’ -> @Code_Collective

    Reply
  31. Karen says:
    Mar 10, 2014 at 9:17 am

    How excellent! That hint about the trash is a gem. And go ahead and laugh – but – I knew what pretty permalinks were – but was confused if that was what acheived with clicking the Post Name option. I’d been confused because I used to do my Pretty Permalinks using the custom option – until this new button was added. So thanks for solving that tiny mystery for me!

    Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
All in One SEO
Improve website SEO rankings with AIOSEO plugin. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2021 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2021)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2021)
    • SiteGround Reviews from 4464 Users & Our Experts (2021)
    • Bluehost Review from Real Users + Performance Stats (2021)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2021 – Step by Step Guide
Deals & Coupons (view all)
LiveChat logo
LiveChat Inc Coupon
Get a 30 day free trial and 30% OFF LiveChat, one of the best live chat service providers for WordPress users.
LearnDash
LearnDash Coupon
Get the lowest price on the best learning management system (LMS) plugin for WordPress.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).

Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
  • Growth Fund
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon
  • AIOSEO

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress Security by Sucuri.