Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save astockwell-ps/3668137 to your computer and use it in GitHub Desktop.
Save astockwell-ps/3668137 to your computer and use it in GitHub Desktop.
PHP: Setup WP Custom Taxonomy with hierarchical URLs (tld/parent_term/child_term/...)
<?php
// via http://wordpress.stackexchange.com/questions/17325/how-to-enable-hierarchical-permalinks-for-hierarchical-taxonomies
// and http://wordpress.org/support/topic/hierarchical-custom-taxonomy-permalinks
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
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment