Support » Requests and Feedback » Subcategories and “nice” permalinks

Subcategories and “nice” permalinks

  • Basically, the one thing keeping me from switiching from MT to WordPress is the URI issue. Right now, there’s a nightly build that’ll let me structure URIs like /categoryname/postname, but what I (and several others, I’ve noticed) need is to be able to have URIs like:
    My knowledge of PHP is small; I can do little tiny adjustments here and there, but this is beyond me. It seems, though, that it wouldn’t be too difficult to include this feature, since a simlar one (for categories) already exists.

Viewing 15 replies - 1 through 15 (of 19 total)
  • I think WordPress 1.2 has that.

    How would that URI structure handle multiple categories or subcategories?

    Moderator Ryan Boren


    WordPress Dev

    /%category%/%postname%/ can handle /parentcategoryname/subcategoryname/postname/; however, when the permalinks are generated, the parent categories are not, at the moment, included. Only the leaf subcat is included. I’ll try to fix this for 1.3. Generating permalinks for multiple categories isn’t possible. %category% can only match one category. A category hierarchy is considered one category.

    Was this “category/subcategory/postname” ever “fixed” and completed? So far, I only see category/postname.

    I’d love it, and I’ve seen it frequently requested.

    Moderator Ryan Boren


    WordPress Dev

    Thanks for reminding me. I just checked it in. Keep in mind that if a post has multiple categories, the first category in the list is used to generate the permalinks.

    Wow! I’ll take a look at it. Will this go into 1.5 or is this a dyi change? Thank YOUOUOUOUOUOU

    Okay, I’m looking at this change, and I’ve added it to the template-functions-links.php, but how should I use this?

    Just select %category% or is there a %category%/%subcat%/ permalink to add? Will this just add the sub automatically?

    I think this is brilliant, I just need a little more detail. You are awesome!

    Okay, copied the changes into the appropriate php file, then set my permalinks to be:


    Based on the implications in the notes at permalinks and subcategories in the CVS, I kept it to this. I checked the htaccess to make sure the permalink changes were embedded, and now I can’t view anything – I just get post not found.

    I took out the permalinks reference to nothing again and updated the htaccess (clicked the button – I like the ease of this when the htaccess file is writable) and I’m back to normal, but without any permalinks.


    Moderator Ryan Boren


    WordPress Dev

    What version of apache? Some versions seem to have regular expressions that are greedy by default which messes up /%category%/%postname%/ since both tags are greedy.

    Here is my server info:

    FreeBSD 4.9-RELEASE
    mysql Ver 12.22 Distrib 4.0.18
    perl, v5.8.3
    PHP 4.3.4

    Also, is it right that all I have to do is put /%category%/%postname%/ and if the post is in a subcategory, the results would be:


    Right? If so, slickooooh!

    Moderator Ryan Boren


    WordPress Dev

    Yes, that’s right.

    and the server info?

    Moderator Ryan Boren


    WordPress Dev

    I don’t see the apache version in there. Here’s something you can do to help debug. For the last rewrite rule, replace ‘[QSA,L]’ with ‘[QSA,L,R]’. Visit a post permalink and look at the URI in your browser’s location field. You should see a query string style URI instead of a cruft-free URI. This will show you what name and category_name are being set to.

    I added the R to a bunch of things in the end section and this is what I got:

    It should be:


    And a solid POST NOT FOUND.

    I’m trying to figure out how to find the apache info on my server. Haven’t found it yet.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Subcategories and “nice” permalinks’ is closed to new replies.