Make WordPress Core

Opened 8 years ago

Last modified 5 months ago

#42248 new defect (bug)

Can't create category slug with same name for different parents

Reported by: ashokrd2013's profile ashokrd2013 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
Component: Permalinks Keywords: has-screenshots dev-feedback needs-patch
Focuses: administration Cc:

Description

Issue with same category slug creation even though both have different parent category.

For example I have structure like this wanted to build up.

Cars - Category
Toyota & Maruti - Subcategory of Cars
Parts - Subcategory of Toyota & Maruti

/cars/toyota/parts
/cars/maruti/parts

Wordpress isn't allow it. See attached screenshot.

Attachments (1)

Screenshot_1.png (9.0 KB) - added by ashokrd2013 8 years ago.

Download all attachments as: .zip

Change History (5)

#1 follow-up: @rinkuyadav999
8 years ago

  • Component changed from Taxonomy to Permalinks

#2 in reply to: ↑ 1 @ashokrd2013
8 years ago

Replying to rinkuyadav999:

Issue with taxonomy slug creation even though taxonomy term has different parent term and generating different permalink based on slug. I don't think it's permalink component.

#3 @rinkuyadav999
8 years ago

  • Keywords has-screenshots dev-feedback needs-patch added

Hi @ashokrd2013

Categories are creating perfectly but slug is different and is not according our expectation. Slug is part of Permalinks so i changed component.

#4 @callumbw95
5 months ago

Hi @ashokrd2013,
I have taken a look into this and can confirm that this issue is happening still in the latest version. However because categories can be moved from one parent to another or even moved to have no parent this could potentially cause issues in the future. However in your example I wonder if there is a way around this by organising your categories in a different way? For example:

  • /cars/toyota
  • /cars/maruti
  • /cars/parts

Then associating your posts under both the relevant manufacturer and the parts category, most likely setting the default category as the manufacturer. This would keep the slugs separate but also allow you to filter correctly for each as under the parts category you could filter them by the manufacturer. Then under the manufacturer you could filter them by parts or otherwise.

Also as I feel like this is potentially related to WooCommerce, I would be tempted to move the manufacturer to the brand attribute on the products so instead of the more general category you make use of the various product taxonomies available to achieve this without creating duplicate slugs. However I may be going a bit off-piste here, so if you have any more context to add that would be much appreciated. 😃

Note: See TracTickets for help on using tickets.