2

I've been learning about taxonomies, custom posts etc though a lot of trial and error. I finally have it working how I want, however now I am getting some conflict with my desired slugs. I can't name my category "venue" because someplace in the database, that's already taken (I assume) - even though I've deleted the category that used it. Now when I try adding the category that I want to use the "venue" slug, WP automatically makes it "venue-2", which I definitely don't want in my url as the folder. Any suggestions for this?

4
  • Any progress on this question?
    – kaiser
    Oct 13 '12 at 15:50
  • @kaiser, I'd love to know how to change that as well. I'd rather avoid messing with the database itself. Oct 27 '13 at 22:26
  • 1
    Clear your trash posts, pages etc. deleting items permanently. Feb 12 '15 at 14:53
  • @MayeenulIslam That should actually be an answer - or search up an answer that you can take and mark this one as duplicate. Thanks.
    – kaiser
    Feb 18 '15 at 0:36
9

This can also be caused by uploading images with the same file name as the post/page. In my case, I uploaded an image called 'careers.jpg' before I created a page called 'Careers', so the page was getting the '-2' appended. To fix it, I just changed the slug on the image, then I was able to change the slug on the page.

1
4

The slug is stored in the post_name column of your posts table. I'd recommend searching that table first before manually assigning that slug, though.

5
  • thank you! this is exactly the information I needed. It's not letting me manually assign the slug, which is a failsafe I guess.
    – jamie
    Sep 11 '12 at 23:53
  • What are you using? You can do this with PHPMyAdmin; I have in the past. Sep 11 '12 at 23:56
  • @Joseph, how about custom post type taxonomy slugs? I don't even have any CPT posts left yet taxonomy keeps adding numbers to slugs... Oct 27 '13 at 22:28
  • Do a complete search of your database for the slug that you are trying to use. Oct 28 '13 at 14:21
  • Thank you. still valuable advice in 2019
    – NAMS
    Jan 16 '19 at 20:08
1

Usually when Wordpress appends the "-2" to a slug, that means you still have the old content, that you meant to delete, in the trash. Be sure to empty your wordpress trash, then try making the slug.

To access the pages in the trash, open the Pages / All pages menu, then click on the "Bin" section that appears on the right hand side of the "All" section. Note that if there is no items in the bin, this section will not appear.

1
  • Is there a trash for slugs somewhere then? :) Oct 27 '13 at 22:25
0

There is another cause for Wordpress appending -2 at the end: When the slug only contains numbers. This is not allowed.

Example: I wanted to name my page 2016 and even though there has never been a 2016 in the database the slug always turned into 2016-2. As far as I remember this is because numbers have a special meaning for workpress (path variables) and they couldn't be distinguished.

So my solution was to manually rename the slug to year-2016 which looks nicer than this "-2" suffix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.