#1787 closed defect (bug) (fixed)
Subcategories with same name not addressable
Reported by: | ringmaster | Owned by: | ringmaster |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 1.6 |
Component: | General | Keywords: | category heirarchy bg|patch |
Focuses: | 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 (1)
Change History (5)
#1
@
19 years ago
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.
#2
@
19 years ago
Putting the full path in the nicename requires quite a lot of changes, so we'll just go with the original patch.
Patches functions.php and classes.php to find subcategories based on their full path.