Quote from studiobenvenutifirenze on August 2, 2024, 20:30
We have a similar problem to another user, this is his support request: https://wordpress.org/support/topic/display-category-url-of-shop-and-breadcrumbs/
As him we would like too show the category url of woocommerce and not the query generated by the plugin but moreover our site has this structure for categories: category-->subcategory1-->subcategory2.
We tried to use the code of that request support but it does not work with category gerarchy but only for the first child, this is the code:
add_action('registered_taxonomy', function () { $site_url = 'https://adv-online.it/'; $current_url = $_SERVER['SCRIPT_URI']; if (str_contains($current_url, 'swoof')) { $data = explode('/', $current_url); if (str_contains($data[5], 'product_cat')) { $tmp = explode('-', $data[5]); $link = "{$site_url}categoria-prodotto/{$tmp[1]}/"; wp_redirect($link); exit; } } });
Our site is: https://adv-online.it/
For example if we filter for APRILIA-->Amico 1° serie 50 cc.-->1990-1992 we would like to show the url https://adv-online.it/categoria-prodotto/aprilia/amico-1-serie-50-cc/ and not the actual: https://adv-online.it/negozio/swoof/product_cat-1990-1992/
Could you please help us?
Thank you,
STUDIOBENVENUTI
We have a similar problem to another user, this is his support request: https://wordpress.org/support/topic/display-category-url-of-shop-and-breadcrumbs/
As him we would like too show the category url of woocommerce and not the query generated by the plugin but moreover our site has this structure for categories: category-->subcategory1-->subcategory2.
We tried to use the code of that request support but it does not work with category gerarchy but only for the first child, this is the code:
add_action('registered_taxonomy', function () { $site_url = 'https://adv-online.it/'; $current_url = $_SERVER['SCRIPT_URI']; if (str_contains($current_url, 'swoof')) { $data = explode('/', $current_url); if (str_contains($data[5], 'product_cat')) { $tmp = explode('-', $data[5]); $link ="{$site_url}categoria-prodotto/{$tmp[1]}/"; wp_redirect($link); exit; } } });
Our site is: https://adv-online.it/
For example if we filter for APRILIA-->Amico 1° serie 50 cc.-->1990-1992 we would like to show the url https://adv-online.it/categoria-prodotto/aprilia/amico-1-serie-50-cc/ and not the actual: https://adv-online.it/negozio/swoof/product_cat-1990-1992/
Could you please help us?
Thank you,
STUDIOBENVENUTI