Forums

[resolved] using %category% in permalinks for subcategories (4 posts)

  1. geoffe
    Member
    Posted 3 years ago #

    The page on permalinks suggests that %category% will display the subcategories as well as nested directories in the URI, but they do not appear with posts. http://codex.wordpress.org/Using_Permalinks#Structure_Tags

    I am using /%category%/%postname% for my structure and I want the links to posts to include categories and subcategories but only categories are used in the URI.

    I am using 2.0.1

  2. geoffe
    Member
    Posted 3 years ago #

    Can anyone point me to the code where %category% is interpreted to see if I can find a way to code the subcategories in?

  3. ManuelViloria
    Member
    Posted 3 years ago #

    Hi! If you create a parent category with a child category, when you Write a Post, associate the post with the child category. Do not check the parent category box.

    When you do that (and assuming your permalink is set to /%category%/%postname%) your URL will look like

    example.com/parentcateg/childcateg/title-of-your-post

    Please note that
    example.com/parentcateg/childcateg
    will yield a 404 page

    While
    example.com/parentcateg
    will be a duplicate of
    example.com/categories/parentcateg
    (assuming you didn't define anything for Categories in your Permalinks set-up)

  4. geoffe
    Member
    Posted 3 years ago #

    Exactly what I wanted to know! I'm such a simpleton.

Topic Closed

This topic has been closed to new replies.

About this Topic