WordPress.org

Make WordPress Core

Opened 7 years ago

Last modified 30 hours ago

#5034 assigned feature request

Impossible to have duplicate category slugs with different parents

Reported by: snakefoot Owned by:
Milestone: Future Release Priority: high
Severity: normal Version: 2.3
Component: Taxonomy Keywords: has-patch
Focuses: 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.

Attachments (2)

5034.diff (3.3 KB) - added by wonderboymusic 17 months ago.
5034.2.diff (3.3 KB) - added by wonderboymusic 11 months ago.

Download all attachments as: .zip

Change History (42)

comment:1 in reply to: ↑ description snakefoot7 years ago

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 :)

comment:2 snakefoot7 years ago

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

comment:3 snakefoot7 years ago

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.

comment:4 markjaquith7 years ago

  • Owner changed from anonymous to ryan
  • Priority changed from normal to high

Pinging Ryan

comment:5 snakefoot7 years ago

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.

comment:6 ryan7 years ago

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.

comment:7 snakefoot7 years ago

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

comment:8 snakefoot7 years ago

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.

comment:9 ryan7 years ago

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

comment:10 snakefoot7 years ago

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

comment:11 ryan7 years ago

  • Milestone changed from 2.3 to 2.4

comment:12 ryan6 years ago

  • Milestone changed from 2.5 to 2.6

comment:13 janbrasna6 years ago

  • Cc janbrasna added
  • Component changed from General to Taxonomy
  • Keywords category tag permalink slug taxonomy unique added; tags removed

Related: #3799 + #3683 + #6211 + #6542

comment:14 Denis-de-Bernardy5 years ago

  • Cc Denis-de-Bernardy added

comment:17 follow-up: janeforshort5 years ago

  • Milestone changed from 2.9 to Future Release

Punting for time and lack of recent activity.

comment:18 in reply to: ↑ 17 arena4 years ago

Replying to janeforshort:

Punting for time and lack of recent activity.

Should be closed for me as not a bug => wontfix

comment:19 kevinB4 years ago

  • Cc kevinB added

comment:20 aesqe3 years ago

  • Cc aesqe@… added

comment:21 wycks3 years ago

  • Cc wycks added
  • Keywords needs-refresh added
  • Type changed from defect (bug) to feature request

Related: #6211

This is ancient but could really use addressing especially for sites that are multilingual, it kills the permalink structure and causes issues with all the multi-language plugins.

For example words in several languages can be the same ( eg:restaurant) so in a multilingual structure WordPress treats them as duplicates.

/test/restaurant/example ... English version

/test/fr/restaurant/example ... French version is not currently possible in WP![BR]


/test/fr/restaurant-1/example ... Works but is ugly

Version 3, edited 3 years ago by wycks (previous) (next) (diff)

comment:22 lkraav2 years ago

Yep, needing this as well with MarketPress shopping cart, bumping and following.

Although assigned version here is 2.3, I guess it's safe to say nothing has changed with this in 3.3.1?

comment:23 gruvii2 years ago

  • Cc gruvii added

comment:24 rosswil22 months ago

  • Cc rosswil added

comment:25 thirstcard21 months ago

  • Cc thirstcard added

wonderboymusic17 months ago

comment:26 wonderboymusic17 months ago

  • Keywords dev-feedback added; category tag permalink slug taxonomy unique removed

Attached is the minimum required to attempt this - however, it breaks the list table hierarchy by not showing the dupe terms, etc. If someone blesses this schema change, we can take it from there.

comment:27 follow-up: wonderboymusic12 months ago

If we tackle Taxonomy in 3.7, this might be a thing

comment:28 wonderboymusic12 months ago

  • Keywords needs-refresh removed

wonderboymusic11 months ago

comment:29 wonderboymusic11 months ago

  • Keywords has-patch added; dev-feedback removed
  • Milestone changed from Future Release to 3.7

For 3.7 taxonomy research

comment:30 greenshady11 months ago

  • Cc justin@… added

comment:31 in reply to: ↑ 27 nacin10 months ago

  • Milestone changed from 3.7 to Future Release

Replying to wonderboymusic:

If we tackle Taxonomy in 3.7, this might be a thing

Not for 3.7.

How does this tie into http://make.wordpress.org/core/2013/07/28/potential-roadmap-for-taxonomy-meta-and-post-relationships/?

comment:34 ircbot4 weeks ago

This ticket was mentioned in IRC in #wordpress-dev by wonderboymusic. View the logs.

comment:35 ircbot4 weeks ago

This ticket was mentioned in IRC in #wordpress-dev by simonwheatley. View the logs.

comment:36 SergeyBiryukov4 weeks ago

  • Milestone changed from Future Release to 4.0

comment:37 SergeyBiryukov8 days ago

  • Milestone changed from 4.0 to Future Release

comment:38 ircbot8 days ago

This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.

comment:39 serpyre8 days ago

We have the solution for this which was coded by some specialist consultants, it allows duplicate category paths and also a separate plugin for duplicate taxonomies for WooCommerce and WPEC, no database changes - it uses the core - so very stable. We are moving over to the retail side (digital music which should be interesting) so if anyone wants to talk about handing over the plugins let us know, info [at] serpyre [dot] com.

Last edited 8 days ago by serpyre (previous) (diff)

comment:40 ryan30 hours ago

  • Owner ryan deleted
  • Status changed from new to assigned
Note: See TracTickets for help on using tickets.