WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Subcategories not showing up in URI with pretty Permalinks (5 posts)

  1. Marventus
    Member
    Posted 2 years ago #

    Hello everyone! I am experiencing a problem with the way WP is handling the %category% tag inside the Permalink structure, and I think this problem might exceed my own installation.

    I have the following custom Permalink structure on my site:

    /%category%/%postname%/

    According to the Permalink documentation:

    %category%:
    A sanitized version of the category name (category slug field on New/Edit Category panel). Nested sub-categories appear as nested directories in the URI.

    However, subcategories are not being included in the URIs. Here is an example: The post is listed under parent cat "Derecho y" ("Law and" in EN) and subcat "Cultura" ("Culture" in EN), but it's permalink structure remains:

    [site-root]/[category]/[postname]

    Instead of:

    [site-root]/[category]/[subcategory]/[postname]

    I have found the following old threads about this issue:

    I made sure that parent category ID numbers are lower than its children's, reset my theme to TwentyEleven, and deactivated all plugins except for Exec-PHP, Role Manager, and Akismet with no results.
    I am using WP 3.3.1 and PHP 5.2.17.

    Any thoughts?

  2. jfrancofarias
    Member
    Posted 2 years ago #

    Hi Marventus,

    The solution is having the parent category ID greater than any of the child ones.

    e.g.

    to show this permalink: http://www.domain.com/parentcat/subcat/post

    Your cat ids should be something like this...

    http://www.domain.com/100/<100/post
    http://www.domain.com/10/2/post, etc.

    How to change your cat ids?

    Here's an article: http://wordpress.org/support/topic/how-to-change-category-ids-in-wordpress-27?replies=7

  3. Marventus
    Member
    Posted 2 years ago #

    The solution is having the parent category ID greater than any of the child ones.

    Thanks for the heads up! I was absolutely 100% convinced that it was the other way around. As the Germans would say, "Scheiße...", ;-)
    I'll try it the other way around and let you know.
    Thanks!

  4. squareaxis
    Member
    Posted 1 year ago #

    I ran into this problem running WordPress 3.4.1, and solved it by only selecting the lowest category in the category hierarchy. Previously, my post had the following 3 categories selected: "MainCat", "SubCat", and "SubSubCat", and the URI produced was "/MainCat/postTitle.html".

    By selecting only the lowest subcategory in the hierarchy ("SubSubCat"), the post URI began properly displaying parent and children categories: /MainCat/SubCat/SubSubCat/postTitle.html

  5. eaglejohn
    Member
    Posted 1 year ago #

    I'm having some weird problems as well:

    I have setup two categories for 3 languages (Dutch, German, English) in WPML.
    Category 1 is the parent of Category 2 in every language.

    The Dutch permalink: …/category1/category2 (cat1 starts with "T', cat2 with "G")
    The German permalink: …/category1/category2 (cat1 starts with "T', cat2 with "G")
    The English permalink: …/category2/category1 (cat1 starts with "B', cat2 with "G")

    Notice that the English permalink shows the categories in a wrong order. Could this have something to do with alphabetically ordering?

    Selecting only the lowest subcategory doesn't work for me, neither having the parent category ID greater than its childs.

    Any suggestions?

Topic Closed

This topic has been closed to new replies.

About this Topic