• Hello,
    Thanks in advance for your help.
    I’m trying to show the Parent category and the Child category in the permalink when both have been assigned.

    In the site I am working on, both the Father and the Son categories have been assigned, the theme shows both “1-cat / 2-cat” categories in the permalink, and the article is shown of the site within the category “2-cat “.
    Normally Wp shows both categories only if only the child category has been selected.

    With the new theme, in fact, the same articles, to which both categories “1-cat / 2-cat” have been assigned, are shown only with the parent category that is “1-cat”.

    In this situation, all existing articles would have a different permalink, but also shown on the site in a different category, i.e. the parent category.

    I am trying to set up the old operation, so as to show both the Parent category and the Child category in the permalink. And the article visible in the child category.

    I hope it is clear.
    Thanks

    • This topic was modified 2 years, 7 months ago by woodypad.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m not aware of any change in category handling within WP core. You say behavior changed when you changed themes? I have to think the theme is altering default behavior in some manner. If a post is assigned a child category, the post should be listed in either a child category or parent category archive. It’s not necessary to assign a parent category when the child category is assigned. Only listing such a post in the parent category archive and not its child is illogical.

    Try visiting the permalinks settings screen to cause rewrite rules to be regenerated. Something there may have gotten scrambled during theme change. If illogical behavior persists, I recommend seeking assistance through your theme’s dedicated support channel.

    Thread Starter woodypad

    (@woodypad)

    Hi,
    In the natural behavior of wordpress, when you assign a child category, the permalink will report the parent category as well.
    Even if it is not logical, if you assign the parent and child categories, wordpress lists only the parent category in the permalink.

    I don’t know why, the old theme on the site changed the natural behavior. And when assigning both categories Father and Child, it behaved as when assigning only the child category.

    Thank you

    Moderator bcworkz

    (@bcworkz)

    Whether it’s logical or not depends on how you look at it ?? Either URL works when both parent and child are assigned, but there can only be one canonical link and to some it makes sense that the highest level category should be the canonical one.

    It is possible to alter the link that WP outputs for any given post. It’s only reasonable to do so if you change it to a link that will still return the correct post. It’s also possible to alter what WP considers to be canonical and you can manage the canonical redirect as well.

    It’s likely your theme has used these filters to alter default behavior. If so, it’s feasible to remove its filter hooks, but you’d need to discover how they were added by the theme. You could simply override what the theme does without removing its hooks, but it’s less efficient than removal.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show Parent Category and Child Category’ is closed to new replies.