Forked from astockwell-ps/PHP Setup WP Custom Taxonomy with hierarchical URLs (tldparent_termchild_term...)
Created
December 14, 2021 01:54
-
-
Save Wendersonandes/97ae9572e019b0e8e50d38869d8390ba to your computer and use it in GitHub Desktop.
PHP: Setup WP Custom Taxonomy with hierarchical URLs (tld/parent_term/child_term/...)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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