Allow duplicate taxonomy slugs?
-
I’m trying to set up a hierarchical taxonomy within my theme which also uses a hierarchical slug rewrite.
This way I can have a category like “collections”, with a subcategory like “earrings” which yet another subcategory like “hoops”.
One issue I’ve ran into is that there cannot be the same taxonomy slug stored, if a duplicate exists it appends the parent’s slug to the end. Is there any way to allow duplicate entries?
The problem I have is that there are multiple sub-categories of the same name which exist in different categories, but are totally independant.
Example:
Collections/Necklaces/Simple-n-Chic
Collections/Earrings/Simple-n-ChicHowever, in creating these links, after defining the first series the second one became:
Collections/Earrings/Simple-n-Chic-Earrings
I do not want this to occur, is there an alternative?
EDIT: The code in use, although it’s currently not “working” on the front end.
register_taxonomy( 'collections', // name/slug 'collections', // object type (custom) array( 'name' => 'Collections', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'labels' => $labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array( 'hierarchical' => true ), ) );
And here is a screenshot of the taxonomy itself, notice simple-n-chic-earrings… that’s the issue:
- The topic ‘Allow duplicate taxonomy slugs?’ is closed to new replies.