Is it possible to remove the ‘Home’ breadcrumb link completely?
Bricks settings:
Hey @jins8,
have a look at my comment here. Instead of array_pop
(which removes the last item of an array) you can use array_shift
to remove the first item.
add_filter( 'bricks/breadcrumbs/items', function( $breadcrumb_items ) {
array_shift( $breadcrumb_items );
return $breadcrumb_items;
} );
Best,
André
Thanks, it seems to work on normal pages but not in templates overriding Woocommerce templates like Product Archive and Single Product.
Hey @jins8,
for the WooCommerce breadcrumbs you need to use a different hook. Try this:
add_filter( 'woocommerce_breadcrumb_defaults', function( $defaults ) {
unset( $defaults['home'] );
return $defaults;
} );
Best,
André
Close, that didn’t work either but this does, combo of your answers, thanks for the help!
add_filter('woocommerce_get_breadcrumb', function ($defaults) {
array_shift($defaults);
return $defaults;
});
Hi, i used a similar hook to remove the last item (product name) from the woocommerce breadcrumbs in my single product template (thanks @aslotta )
add_filter('woocommerce_get_breadcrumb', function ($defaults) {
array_pop($defaults);
return $defaults;
});
Issue is, that also removes the link from the last child category. So it is
home > parent category > child category
but child category is plain text.
I guess that’s the behavior of breadcrumbs, as normally the last item is the page you are viewing so a link is unnecessary. Anybody got a solution for my case? Thanks!
Thank you!! I’ve been at it for hours trying to get my breadcrumbs the way I want. Finally landed on the Bricks builder breadcrumbs after trying a few other breadcrumb plugins, because the Bricks crumbs was best… except I didn’t want the “Home” there for a certain post type.
Your snippet is excellent!
The best breadcrumb plugin:
If you need flexible settings and full control, then it will solve your problems. I’ve had it on all the sites for a long time, including those created using Bricks.