Hierarchical taxonomy URL's for CustomPress?


From what I've read, Wordpress 3.1 now supports hierarchical taxonomies when you register a taxonomy with: rewrite => array('hierarchical' => true )

I am trying to achieve urls that appear as: http://www.domain.com/tax-name/parent-tax/child-tax, instead of http://www.domain.com/tax-name/child-tax

I was wondering if you had any plans to implement this into a future release? In the mean time, could you recommend a hack to achieve this?


  • DavidM
    • DEV MAN’s Mascot

    Hello cmjnetwork,

    That's a good question! I hadn't really thought about hierarchical rewrites for taxonomy terms myself, but it sounds like it could be very useful. Let me see if I can get one of our developers to give some insight on that.


  • Ivan
    • The Incredible Code Injector

    Definitely, this will go into the next release of CustomPress which is just around the corner, plus more WP 3.1 goodies for post_types, taxonomies and custom fields.

    You can hack it like that:

    Open "custompress/modules/content-types/core/core.php" and edit Line 261

    $args['rewrite'] = array( 'slug' => $_POST['rewrite_slug'] );
    $args['rewrite'] = array( 'slug' => $_POST['rewrite_slug'], 'hierarchical' => true );

    Make sure you have the advanced option selected when you add taxonomies for this option to take effect.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.