WordPress filter hook

woocommerce_breadcrumb_main_term

Defined by WooCommerce and fired by 7 plugins in total, running on 7.1M+ sites between them.

“Filters the main term used in product breadcrumbs.”

How to use woocommerce_breadcrumb_main_term

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_breadcrumb_main_term', function( $terms, $terms2 ) {
	// Change $terms here.
	return $terms;
}, 10, 2 );

Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

7 plugins that fire woocommerce_breadcrumb_main_term

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_breadcrumb_main_term', $terms[0], $terms ) src/Blocks/CoreBreadcrumbsCompatibility.php:73
  2. The Plus Addons for Elementor icon The Plus Addons for Elementor100,000+ installs apply_filters( 'woocommerce_breadcrumb_main_term', $terms_cate[0], $terms_cate ) modules/widgets/tp_breadcrumbs_bar.php:1755
  3. Thim Elementor Kit icon Thim Elementor Kit20,000+ installs apply_filters( 'woocommerce_breadcrumb_main_term', $terms[0], $terms ) inc/elementor/widgets/global/breadcrumb.php:374
  4. Nexter Blocks icon Nexter Blocks9,000+ installs apply_filters( 'woocommerce_breadcrumb_main_term', $terms_cate[0], $terms_cate ) classes/tp-block-helper.php:1111
  5. Feed KuantoKusta for WooCommerce icon Feed KuantoKusta for WooCommerce100+ installs apply_filters( 'woocommerce_breadcrumb_main_term', $terms[0], $terms ) includes/class-wc-feed-kuantokusta.php:1042
  6. Sticky WooCommerce Category Menu icon Sticky WooCommerce Category Menu10+ installs apply_filters( 'woocommerce_breadcrumb_main_term', $main_term, $terms ) includes/floating-helpers.php:551
  7. Official Pricerunner Product Feed icon Official Pricerunner Product Feed10+ installs apply_filters( 'woocommerce_breadcrumb_main_term', $terms[0], $terms ) models/Model.php:80

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.