How do I edit category slugs?

  • Unknown's avatar

    I have used the category feature to create themed pages with a corresponding menu in the left sidebar of my blog.

    For some reason the category slugs do not all match the category titles. Some have a -2 after the title. Eg. for the ‘radio’ page, the slug is ‘Radio-2’.

    I think that this may be connected to duplicate categories that may have been created in the past, however there is no ‘trash’ bin in the category window, so as far as I can see there is no way of deleting old, redundant categories.

    Just to be safe I have already emptied the trash in both my pages and posts.

    Is there a way to edit these category slugs?

    MH
    Blog url: http://mirandahinkley.wordpress.com/

  • Category slugs cannot be edited, but they can be deleted and re-created.

    Keep in mind that Categories and Tags share the same slugs. You may have a Category as radio-2 because you already have a Tag as radio.

  • Unknown's avatar

    Thanks for the reply.

    Will deleting all ‘radio’ tags therefore get rid of the ‘-2’. Or do I need to do that, delete the category, re-create it, and then re-categorise all posts?

    And having done that, will I then be able to re-tag everything with ‘radio’ without altering the appearance of the slug? Ie. – does it have anything to do with the order in which you generate the tags vs. the categories?

    Cheers,

    MH

  • Unknown's avatar

    Hi there,

    Will deleting all ‘radio’ tags therefore get rid of the ‘-2’. Or do I need to do that, delete the category, re-create it, and then re-categorise all posts?

    Yes, you’ll have to delete them and recreate them, and then reassign the new tag/category to your posts. You can assign them in bulk however, as per: http://en.support.wordpress.com/posts/categories/#bulk-actions

    I am not too sure what you mean with your second question regarding the appearance of the slug. If you could clarify that, it would be great.

    Thanks

  • Unknown's avatar

    Hi,

    Thanks for this – I worked out the second question in the course of doing what you suggested – do go ahead and close the thread unless you have any corrections to the below…

    For the benefit of anyone else reading – slugs are assigned to both categories and tags, and where the same word or phrase is used, slugs are assigned in the order that fresh categories/ tags are created.

    So if you create a tag, then a category, with the same name, the category will have the slug name_2, whereas if you do it the other way round, it’s the tag that will end up with name_2 as the slug.

    To re-cap – if you’re trying to get rid of _2 slugs from your category URLs, you’ll need to:

    1. Delete all tags that duplicate the name of your category (do this from tags page, rather than on individual posts, otherwise the tag will remain).
    2. Delete the categories (on category page)
    3. Re-create the categories, and re-assign your posts to those categories.
    4. If you’ve used the categories in a custom menu, make sure you re-create the menu.
    5. Re-tag everything.

    MH.

  • The topic ‘How do I edit category slugs?’ is closed to new replies.