1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Wordpress: Categories and Subcategories in Permalink

Discussion in 'WordPress' started by amitpagarwal, Jun 4, 2007.

  1. #1
    I have a post in wordpress which belongs to two categories - one is a parent and other is a child [like digital camera --> nikon]

    My permalink structure is like this /category/postid/

    When i make a post, WP would generate the URL as ww.abc.com/digital-camera/nikon/382/ which is perfect.

    However, there are instances when WP won't add the sub-category nikon to the URL and it would then look like abc.com/digital-camera/382

    Why does WP skip the sub-category. Any clues ?
     
    amitpagarwal, Jun 4, 2007 IP
  2. CypherHackz

    CypherHackz Well-Known Member

    Messages:
    447
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    155
    #2
    not sure. if you use this structure

    /%category%/%postname%/

    wordpress should display like this if you posted the article in chile category

    /category/child-category/postname/

    btw why did you use postid instead of postname?

    -cypher.
     
    CypherHackz, Jun 4, 2007 IP
  3. amitpagarwal

    amitpagarwal Peon

    Messages:
    375
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Here's the exact structure of the permalink:

    /%category%/%postname%/%post_id%/

    This should produce URL as /category/child-category/postname/ but sometimes the child-category is missing from the URL.
     
    amitpagarwal, Jun 4, 2007 IP
  4. CypherHackz

    CypherHackz Well-Known Member

    Messages:
    447
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    155
    #4
    im not sure why it be like that. it suppose to be like i described in my earlier post.

    or maybe you set the entry to be published in category and child category?

    -cypher.
     
    CypherHackz, Jun 4, 2007 IP
  5. webincarno

    webincarno Peon

    Messages:
    231
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes if you set the post in category and subcategory both the the url produced will be: /category/postname/

    if you set it to subcategory only then you will have what you desire:
    /category/child-category/postname/
     
    webincarno, Sep 5, 2007 IP
  6. applesfaceman

    applesfaceman Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thanks for this thread, evne though its like 100 years old i was uncertain if i could do this same thing. then i found /%category%/%postname%/ but my post url was only showing the main parent category. but i had the parent and several sub categories checked, once i selected the latest sub category my urls display exactly how i wanted them to.

    thank you everyone for being awesome enough to help people here!
     
    applesfaceman, Apr 28, 2012 IP
  7. Nikole with a 'k'

    Nikole with a 'k' Greenhorn

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #7
    What if you have a product that goes in two separate categories that aren't parent/child?
    How can I get the URL to include both categorie slugs?
     
    Nikole with a 'k', May 6, 2013 IP