// Remove first item in breadcrumb add_filter('woocommerce_get_breadcrumb', 'remove_first_item_in_breadcrumbs', 10, 2); function remove_first_item_in_breadcrumbs($crumbs, $breadcrumb) { // Check if WooCommerce is active and it's a product page if (class_exists('WooCommerce') && is_product()) { // Remove the first item in the breadcrumbs array_shift($crumbs); } return $crumbs; } // Remove last item in breadcrumb add_filter( 'woocommerce_get_breadcrumb', 'bbloomer_single_product_edit_prod_name_breadcrumbs', 9999, 2 ); function bbloomer_single_product_edit_prod_name_breadcrumbs( $crumbs, $breadcrumb ) { if ( is_product() ) { global $product; $index = count( $crumbs ) - 1; // product name is always last item $value = $crumbs[$index]; $crumbs[$index][0] = null; } return $crumbs; } // Remove separatot in last item add_filter( 'woocommerce_breadcrumb_defaults', 'wcc_change_breadcrumb_delimiter' ); function wcc_change_breadcrumb_delimiter( $defaults ) { // Change the breadcrumb delimeter from '/' to null $defaults['delimiter'] = null; return $defaults; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter