• Resolved thuesen

    (@thuesen)


    Hi guys,

    I’m using %category% in my permalinks, to get some more keywords in the URL, rather than a “useless” date

    This is the setup I have:

    /%year%/%category%/%postname%

    I have %year% first as WordPress recommends NOT to use a text string as the first part (some database performance thing later on).

    Anyway – it works great, but if I publish a post in the “Sony Ericsson”-subcategory, which is under its parent “Mobiles”, then the permalink will look like this:

    /2009/mobiles/sony-ericsson-mobiles/%postname%

    I don’t need both “mobiles” (the parent) and “sony-ericsson-mobiles” (subcategory+parent) in the URL, the latter would be enough. The subcategory I posted in was in fact just “Sony Ericsson”, so I assume the “-mobiles” is added because that’s the parent.

    Any way to remove the parent categories from %category% and only use the category actually selected for the post?

    Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter thuesen

    (@thuesen)

    Update. I’ve learned that categories and tags cannot “share name”, so it was actually the slug that was the problem, it was not %category/%subcategory%-%category%/%postname% but %category%/%subcategory slug%/%postname% … and the slug of my subcategory got the category attached to the end, if it’s slug was already used by a tag.

    And since I had a tag slug named “sony-ericsson”, it would then add “-mobiles” to the end.

    I resolved it by removing the “Sony Ericsson” tag and hence the “sony-ericsson” slug. Then I could rename my slug from “sony-ericsson-mobiles” to “sony-ericsson”, making my URL be /2009/mobiles/sony-ericsson/%postname% instead.

    That’s good enough for me. Now I just have to stop using tags.

Viewing 1 replies (of 1 total)
  • The topic ‘Permalinks: Having only subcategory as ?tegory% ?’ is closed to new replies.