Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a category that ends with -2, and there's no way I can change it back to the plain word. I know there are problems with numeric slugs, but this is just a word. I also know that a common answer is to look in the trash, but there's no trash for categories as far as I'm aware

share|improve this question

2 Answers 2

up vote 5 down vote accepted

You probably have a tag with the same slug. You can't have any taxonomies with duplicate slugs. Either delete that other taxonomy, rename/change its slug, or change/rename this category.

EDIT

Ok, it turns out you can do this, if you don't mind programming the fix or directly executing the SQL or messing with PHPMyAdmin. What you need to do is add a new row in wp_term_taxonomy that uses the term with the slug you want to use as the term_id and the new taxonomy (category in this case) as the taxonomy. This is necessary because, if the slug already exists, WP creates a new term rather than using the same term with a different term_taxonomy relationship.

share|improve this answer
    
Great, I didn't realize tags and categories shared the same space –  Sander Rijken Sep 22 '10 at 14:07
    
Huh? All categories at my blog are duplicated as tags with exactly same name and slug. I need to get rid of tags some time, but works just fine. –  Rarst Sep 22 '10 at 14:38
    
@Rarst That's actually not possible. The slug field in the terms table of the database requires unique information: codex.wordpress.org/Database_Description#Table:_wp_terms I don't know the specifics of your site, but my guess is that your site is using some term_taxonomy magic to pull that one off. –  John P Bloch Sep 22 '10 at 15:15
1  
Ok, looked into it. It sounds like Rarst used the category/tag converter. That uses the established set of terms (from either categories or tags) and doesn't recreate the term, only creates a new term_taxonomy and duplicates the term_relationships that exist. So Rarst, your terms aren't duplicated, they have two term_relationships. –  John P Bloch Sep 22 '10 at 15:24
    
Ehm, never converted anything, never knew there even was a restriction on names/slugs... rarst.net/category/software rarst.net/tag/software My only guess it wasn't required in earlier versions and my structure was grandfathered, it's >2 years old. –  Rarst Sep 22 '10 at 15:53

Maybe there you used such category name before as subcategory or category and then deleted it. When you created second time category with such name- it got -2.

I had a similar problem. Just removed a new category with -2 slug, then created category in subcategory directory where I deleted it. Then just changed parent- made it parent category.

share|improve this answer
    
As John explained, it can be any term from any post object taxonomy. –  toscho Nov 24 '12 at 5:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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