WooCommerce now integrates with the WordPress Core Breadcrumbs block via the block_core_breadcrumbs_items filter (introduced in Gutenberg #74169). This means that the woocommerce_get_breadcrumb filter, previously only applied to WooCommerce’s Store Breadcrumb block, now also applies to the Core Breadcrumbs block.
Important change: Second parameter may now be null
The woocommerce_get_breadcrumb filter signature is:
apply_filters( 'woocommerce_get_breadcrumb', array $crumbs, WC_Breadcrumb|null $breadcrumb );Previously, the second parameter ($breadcrumb) was always an instance of WC_Breadcrumb. With this change, when the filter is called from the Core Breadcrumbs block context, the second parameter will be null.
How can developers tell if they are affected?
You are affected if all of the following are true:
- Your site uses the WordPress Core Breadcrumbs block (not WooCommerce’s Store Breadcrumbs block!).
- You have code that hooks into the
woocommerce_get_breadcrumbfilter. - Your filter callback uses the second parameter (
$breadcrumb) and assumes it’s always aWC_Breadcrumbobject.
Note: If you’re using WooCommerce’s Store Breadcrumb block (woocommerce/breadcrumbs), this change does not affect you. The second parameter will continue to be a WC_Breadcrumb instance as before. This advisory only applies when using the WordPress Core Breadcrumbs block (core/breadcrumbs).
Example of potentially affected code:
add_filter( 'woocommerce_get_breadcrumb', function( $crumbs, $breadcrumb ) {
// ❌ This will cause an error when called from Core Breadcrumbs block context
$breadcrumb->add_crumb( 'Custom Crumb', '/custom-url/' );
return $crumbs;
}, 10, 2 );What action do developers need to take if affected?
If your filter callback uses the second parameter, add a null check before using it:
add_filter( 'woocommerce_get_breadcrumb', function( $crumbs, $breadcrumb ) {
// ✅ Safe: Check if $breadcrumb is available before using it
if ( $breadcrumb instanceof WC_Breadcrumb ) {
$breadcrumb->add_crumb( 'Custom Crumb', '/custom-url/' );
}
return $crumbs;
}, 10, 2 );If your callback only modifies the $crumbs array (the first parameter) and does not use the second parameter, no changes are required:
add_filter( 'woocommerce_get_breadcrumb', function( $crumbs ) {
// ✅ This will continue to work without changes
$crumbs[] = array( 'Custom Crumb', '/custom-url/' );
return $crumbs;
} );This change will be included in WooCommerce 10.6, currently scheduled for March 10, 2026.
Leave a Reply