WordPress.org

Ready to get started?Download WordPress

Forums

Category Slug adds parent category name to child (7 posts)

  1. nublooo
    Member
    Posted 5 years ago #

    Hi,

    I originally posted this in the Troubleshooting forum but I think it's more at home here. Sorry for the double.

    Why does WordPress (2.6.1) automatically add the parent category name to a sub category slug? Unless I'm missing something, and I looked everywhere, it does this automatically upon creating new sub categories. Editing them won't help either, I'm not able to change them either - it doesn't give me an error but just closes the edit page quitely, and it always adds the parent to whatever I write again.

    Example:
    Parent Category "Shoes"
    |
    Child Category "Running Shoes"
    |
    Child Category "Sandals"

    Permalink for Running Shoes is
    mysite.com/shoes/running-shoes-shoes/postname

    Permalink for Sandals is
    mysite.com/shoes/sandals-shoes/postname

    This becomes even more annoying with deeper structures:

    mysite.com/shoes/running-shoes/indoor-running-running-shoes-shoes/postname

    Has anyone come across this already?

  2. bradybd
    Member
    Posted 5 years ago #

    I'm experiencing the same exact problem on a 2.6.1 installation. It is only occurring with specific categories, not all of them.

    I will try to recreate the behavior in a 2.6.0 installation.

    -Brady

  3. nublooo
    Member
    Posted 5 years ago #

    bumppp :)

    Anyone having this problem too? Maybe a solution? Or an idea?

  4. moshu
    Member
    Posted 5 years ago #

    What is the "problem"? For most us that's the expected behaviour: parent/child categories form a hierarchy and if you chose to include the cat name in the permalinks, then it will show the "path" (of nice permalinks) to your post.

  5. mike34
    Member
    Posted 5 years ago #

    I am having the same stupid problem. Already spent hours trying to find out the solution but still unable.

    I am hating wordpress these days. Blogspot was way better. Considering joomla.

  6. www_chees_info
    Member
    Posted 5 years ago #

    I had the same problem and decided to dive in the source code to look what's causing this. I found some wp_unique_term_slug function which mentions in a comment:
    "The $slug has to be unique global to every taxonomy, meaning that one taxonomy term can't have a matching slug with another taxonomy term. Each slug has to be globally unique for every taxonomy."

    So apparently you can't have categories and tags with the same slugs, so I deleted the tags with the same name and after that I was able to make the categories without the slugs getting renamed.

    Still kinda silly that it works like this though.

  7. Nikole Gipps
    Member
    Posted 4 years ago #

    I found this happening with a WordPress installation that had been ported over from Squarespace. Basically, I had to go look into the categories in the database ... what was happening is that there were some random misplaced things in there that were messing with the slug. For example, if some misfit entry you have in there already has the category slug you are looking for, WP will add another hypen and other stuff to the slug you are trying to enter. So go look at that and see if that fixes the problem.

Topic Closed

This topic has been closed to new replies.

About this Topic