Ticket #5034 (new defect)

Opened 8 months ago

Last modified 3 months ago

Impossible to have duplicate category slugs with different parents

Reported by: snakefoot Assigned to: ryan
Priority: high Milestone: 2.6
Component: General Version: 2.3
Severity: normal Keywords: tags
Cc:

Description

I'm using Wordpress as a CMS tool where categories are used as macro level grouping.

Windows XP -> Utilities Windows Vista -> Utilities

This is no longer possible with WP 2.3, which ignores parent category when testing whether a slug is unique.

Change History

(in reply to: ↑ description ) 09/21/07 20:12:54 changed by snakefoot

Guess it is also impossible to have duplicate slugs with different taxonomy. Forexample I have a link category called "news" and I also have a post-category called "news".

But I can see that this is no longer possible with the new database design, and removing these new limitations would require a redesign of the database. And I guess this not something which is going to happen in the 2.3 branch.

Glad that WP 2.0 is kept alive for several more years :)

09/21/07 20:34:38 changed by snakefoot

Whoops two different taxonomy can point to the same slug, so the situation with link-category and post-category is not an issue.

09/21/07 20:41:11 changed by snakefoot

Would it be possible to change the term_taxonomy table so the unique key is "term_id + taxonomy + parent" ? (Instead of "term-id + taxonomy")

Then would be a matter of correcting the upgrade function, so it would create multiple entries in the term_taxonomy table if several category is has similar name but different parents.

09/21/07 21:18:38 changed by markjaquith

  • owner changed from anonymous to ryan.
  • priority changed from normal to high.

Pinging Ryan

09/21/07 21:56:04 changed by snakefoot

Just peeked at some of the category code, and it seems there is some kind of conversion from the taxonomy + terms table to the old category format.

Sadly enough it expects a one to one relationship between the taxonomy and terms table, and gets angry when two different taxonomy entries points to the same term (Just tried to change the unique index to see what happened). It seems to use the id of the term to identify the category, where it probably should use the id from the taxonomy table.

09/22/07 00:35:17 changed by ryan

In retrospect, we probably should have gone with passing term_taxonomy_id instead of term_id + taxonomy around the API and adding parent to the term_taxonomy keying. But, term_id + taxonomy is what we have. I think we'll have to make new term_ids with unique slugs to work around this.

09/22/07 01:00:16 changed by snakefoot

Guess one should be able to change the inner workings of the API, so terms are identified using the taxonomy-id instead. Post-categories, link-categories and tags would use taxonomy-id as their id.

This wouldn't break API's (one can always get a unique term using the taxonomy-id). Though it would change id's for all taxonomy-types (like ids changes with WP 2.3), and plugins will require a new API to aquire the actual term-id.

But it will pretty much require a complete rewrite of all taxonomy code :)

Guess I'm stuck with WP 2.0

09/22/07 01:19:21 changed by snakefoot

Btw. WP already makes new slugs when upgrading (avoids duplicate slugs by appending a counter), but not very elegant though will probably be acceptable for most.

09/22/07 18:01:08 changed by ryan

(In [6157]) Term with slug that conflicts with existing term with different parent gets a new term entry with a unique slug. see #5034

09/23/07 09:35:22 changed by snakefoot

Should I create a new ticket for 2.4 so this one can get closed ?

09/23/07 19:16:15 changed by ryan

  • milestone changed from 2.3 to 2.4.

02/18/08 17:41:04 changed by ryan

  • milestone changed from 2.5 to 2.6.