Ecommerce Shopify WordPress Discussion

Multiple custom post types with single taxonomy URL rewrite

I've created 2 custom post types (let's call them "cpt-1" and "cpt-2"). These two CPTs share the same custom taxonomy (called "category"). I've done this with the ACF plugin. Here's the default URL structure: Single post (cpt 1): example.com/cpt-1/post-name Single post (cpt 2): example.com/cpt-2/post-name Taxonomy archive: example.com/category/category-name/subcategory-name Here's what I need: Single post (cpt 1): example.com/cpt-1/category-name/post-name Single post (cpt 2): example.com/cpt-2/category-name/post-name This should also work if a single post is associated with a sub-category, for example, example.com/cpt-1/category-name/subcategory-name/post-name Taxonomy archive (showing cpt 1 posts only): example.com/cpt-1/category-name/ Taxonomy archive (showing cpt 2 posts only) : example.com/cpt-2/category-name/ This should also work for sub-categories, for example example.com/cpt-1/category-name/subcategory-name Is it possible to do this? I've already consulted dozens of topics and articles. The simplest and most concise solution seems to be this: Wordpress URL Rewrite to sync custom taxonomy and post type I also find a code that manage hierachical taxonomy (category and subcategories) : https://gist.githubusercontent.com/igorbenic/3ba41de1db69bf028651e98b4615cfee/raw/c38bc462bbcfb21ebd1784ede59c5841767f5eb3/request2.php From what I understand, a custom rewrite rule must be used to restructure URLs, and a post_type_link filter to display new URLs, but I don't have a good enough level of coding to adapt it to my case. Here are the features I'm having trouble finding: Taxonomy hierarchy management in the URL (example.com/cpt/category/subcategory/subsubcategory/post-name) Use the same taxonomy archive for 2 different custom posts (example.com/cpt-1/category AND example.com/cpt-2/category). Besides, I don't even know if it's possible to separate the taxonomy archive according to the CPT. If it's too complex, I'm tempted not to use taxonomy, and to create a page hierarchy for each CPT to have the URL structure I want easily (for example, inside a custom post type, create a "category-name" single post as parent page, and a "post-name" child single post). What do you think about it? Thanks in advance :)
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.