John Davidson

php - WooCommerce: duplicate category child slug, different parent

0 comments
Message:


We have a WooCommerce site with 2 parent categories:
New Furniture and Used Furniture.


They both have a child category called Chairs.


These are the URL's we get:


/new-furniture/chairs


/used-furniture/chairs-1


I can't change the slug of chairs-1 to chairs, why is this the case? And how would i fix this?



My Answer:
The issue you are facing is due to the fact that WordPress does not allow duplicate category slugs even if they are under different parent categories. In this case, both "New Furniture" and "Used Furniture" have a child category called "Chairs", which is causing the conflict.

To fix this issue, you can consider the following solutions:

1. Rename one of the "Chairs" categories:
- You can rename one of the "Chairs" categories to something unique, such as "Chairs New" or "Chairs Used", to differentiate between them.

2. Use a different permalink structure:
- You can change the permalink structure for categories to include the parent category in the URL, such as "/new-furniture/chairs" and "/used-furniture/chairs", to distinguish between them.

3. Use custom taxonomies:
- Instead of using categories, you can create custom taxonomies for "New Furniture" and "Used Furniture" to avoid conflicts with duplicate slugs.

4. Use a plugin:
- There are plugins available that can help you manage and customize your category URLs, such as "Custom Permalinks" or "WP Category Permalink", which may provide additional options for resolving this issue.

By implementing one of these solutions, you should be able to resolve the issue of duplicate category slugs and have unique URLs for each category.

Rate this post

4 of 5 based on 1350 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us