Make WordPress Core

Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#1787 closed defect (bug) (fixed)

Subcategories with same name not addressable

Reported by: ringmaster's profile ringmaster Owned by: ringmaster's profile ringmaster
Milestone: Priority: normal
Severity: normal Version: 1.6
Component: General Keywords: category heirarchy bg|patch
Focuses: Cc:


If you create two categories named "subcategory" under separate primary categories ("one" and "two", for example), such that the categories are accessible via:


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)

heir_cats.diff (3.0 KB) - added by ringmaster 18 years ago.
Patches functions.php and classes.php to find subcategories based on their full path.

Download all attachments as: .zip

Change History (5)

18 years ago

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

#1 @ryan
18 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 @ryan
18 years ago

Putting the full path in the nicename requires quite a lot of changes, so we'll just go with the original patch.

#3 @ryan
18 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [2968]) Use full hierarchy when resolving category URIs. fixes #1787 Props: ringmaster Owen

#4 @(none)
17 years ago

  • Milestone 2.0 deleted

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.