Ticket #1787 (closed defect (bug): fixed)
Subcategories with same name not addressable
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | 1.6 |
| Severity: | normal | Keywords: | category heirarchy bg|patch |
| Cc: |
Description
If you create two categories named "subcategory" under separate primary categories ("one" and "two", for example), such that the categories are accessible via:
/category/one/category AND /category/two/category
WordPress fails to find the second category.
The attached patch attempts to select the category based on the full path of the category, not just the last category name in the heirarchy. Failover is included to use just the last category specified in the heirarchy, similar to the current implementation.
This implementation extends the category cache to include full path information upon cache generation. This info is used to index full category paths to their category IDs.
A similar approach might be used to affect the same problem within the page heirarchy.
Attachments
Change History
ringmaster — 6 years ago
-
attachment
heir_cats.diff
added
How about storing the full path in category_nicename? This way we wouldn't have to worry about duplicate names in the DB, and we wouldn't have to construct it on the fly when setting up the cache.
We'd need to add some code to the upgrade to put the full path in category_nicename and modify wp_insert_category() so that it inserts the full path.
Putting the full path in the nicename requires quite a lot of changes, so we'll just go with the original patch.
- Status changed from new to closed
- Resolution set to fixed

Patches functions.php and classes.php to find subcategories based on their full path.