If you have a category called “term” and a subcategory called “subterm”, your can access subterm posts at /cat/subcat. But this doesn’t work out of the box with custom taxonomies. They are accessible at /taxonomy/subterm, but not /taxonomy/term/subterm.
They’ve gone over this in the WordPress Trac (http://core.trac.wordpress.org/ticket/12659), and it kind of looks like they have a solution, but as I’ve never used the Trac and don’t fully understand its language (diffs, etc), I need someone more experienced to actually tell me how to implement this. Is there code there that I have to paste into WordPress core files? Is this already implemented and I can add something to my theme’s functions.php?
If possible I’d prefer not to modify any core files. Help!
4 Answers
This is implemented in WordPress now as of 3.1.
When you register your taxonomy, make sure to set rewrite hierarchical to true as well as the taxonomy itself:
<?php
register_taxonomy('genre',array('book'), array(
'hierarchical' => true, // this makes it hierarchical in the UI
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'hierarchical' => true ), // this makes hierarchical URLs
));