WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#13889 closed enhancement (duplicate)

permalinks for 'hierarchical' custom taxonomies do not behave hierarchically - is this correct?

Reported by: yeswework Owned by: dd32
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:

Description

with conventional Categories, the permalinks generated and recognised by WordPress reflect the true hierarchy – so you might have a parent category books, a subcategory fiction, a further subcategory novels, and so on, and a function like wp_list_categories would then generate the appropriate link /books/fiction/novels/ etc...

with custom taxonomies that have 'hierarchical = true', the behaviour is generally identical to Categories (eg. in the GUI). and yet the permalinks generated / accepted do not reflect the hierarchical structure – instead only one level appears to be accepted: either /books/fiction or /books/novels but not /books/fiction/novels etc...

I can't tell whether this is a bug or a feature, or understand why it would be different - nor could I find any reference to it after an extensive search. can anyone clarify?

the difference relates in part to the slightly different regular expressions for categories and custom taxonomies that turn up in rewrite rules, but I think it goes deeper than that, too.

thanks.

Attachments (1)

hierarchical-term-links.php (1.5 KB) - added by dd32 5 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 @dd325 years ago

  • Milestone changed from Unassigned to Future Release
  • Owner set to dd32
  • Status changed from new to accepted

for 3.0, Yes, this is the current behaviour.

I'm sure theres another ticket for this, however, cant seem to find it right now.

I'll take care of it in 3.1, setting to Future Release for now until patch is available.

For now, You can implement it yourself for a taxonomy, See this code for an example (replace 'state' with your own taxonomy in all cases obviously) http://dd32.id.au/files/wordpress/example-hierarchical-term-links.php

For future sake, I'm attaching a copy of the file

comment:2 @kevinB5 years ago

  • Cc kevinB added

comment:3 @epicalex5 years ago

  • Cc epicalex added

comment:4 @nacin5 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.