Skip to content
Advertisement

WooCommerce: Remove “Products” archive from Yoast breadcrumbs

I want to remove the link to the products archive in the breadcrumbs on all pages.

To do that, I found a solution in the Yoast docs. It works fine except on the product pages. Here’s my current code:

JavaScript

It removes the link on archive pages and all other WooCommerce pages as you would expect by the conditional tag is_woocommerce().

But for some reason it won’t work on the single product page. As you can see, I added an extra check if I’m on a product page with is_product(). Unfortunately that doesn’t work. And is_singular('proudct') don’t worl either.

Maybe there is something wring wihth the $links array? But I’m not sure how to check that.

Advertisement

Answer

I changed the if condition to this:

JavaScript

Now it works. The other pages worked before without the function.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement