• 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?

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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

    Thread Starter nublooo

    (@nublooo)

    bumppp ??

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

    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.

    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.

    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.

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Category Slug adds parent category name to child’ is closed to new replies.