That is due to the fact, that your filter woocommerce_breadcrumb
doesn’t even exist.
This filter here works and pulls out all the elements, that are currently in the breadcrumb (as an array):
add_filter( 'woocommerce_get_breadcrumb', 'change_breadcrumb' );
function change_breadcrumb( $crumbs ) {
var_dump( $crumbs );
return $crumbs;
}
And this filter pulls out the main term
(as an object).
add_filter( 'woocommerce_breadcrumb_main_term', 'change_breadcrumb' );
function change_breadcrumb( $main_term ) {
var_dump( $main_term );
return $main_term;
}
The ‘main term’ is just the first element that is returned by this function (reference):
$terms = wc_get_product_terms( $post->ID, 'product_cat', array( 'orderby' => 'parent', 'order' => 'DESC' ) )
See the Action and Filter Hook Reference by woothemes for all hooks & filters.
Related Posts:
- How to pass/get data to/from the WooCommerce data-product_variations object?
- Filter hook before create order WooCommerce
- Add default user field to WooCommerce checkout [closed]
- Woocommerce “added to cart” message on main(home) page
- Redirect to woocommerce checkout after adding to cart – item already in cart
- How to access page variable inside action hook
- WooCommerce comments_template Filter Not Firing
- Passing Additional Parameters to add_filter Callable
- Modify WordPress Rest Api Request/Response
- How to add some custom HTML into wordpress admin bar?
- Custom theme hooks / filters – passing arguments
- How to hook wp_list_pages?
- Display WooCommerce newest product reviews on top [closed]
- How to make post and comment count unclickable with dashboard_glance_items hook
- How to use the_excerpt in a filter hook?
- Hook into admin post list page
- How can I hide all posts that don’t have a thumbnail?
- Change text of Description in Image Library
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- Am I using the right hook for removing quicktags on the admin TinyMCE?
- About Hooks and Filters
- Add Dropdown menu using “add_filter => wp_nav_menu_items”
- Should I use add_action(‘publish_post or add_filter(‘publish_post?
- How to get list of all hooks of current theme / plugin?
- What hook/filter can I use to add/edit/show/hide the title under (on hover) links on the table view?
- Woocommerce Shipping module available only for type of products [closed]
- Change WordPress RSS link with filter?
- Add a header before fields added with the attachment_fields_to_edit() filter
- Hide content editor for posts after approriate date
- Is there a Woocommerce hook that fires when applying a coupon but before checking if it’s valid?
- What is the action hook for an order that fails on frontend checkout in WooCommerce?
- Why my admin doesn’t work after adding rest_prepare_post filter?
- add_filter() function misunderstanding
- Same Conditionals Not Working on Two Different Hooks
- Filter or Hook to catch pre-rendering of post content
- Can the wp_filter object hold multiple values with the same key
- check to see if hook is available
- apply_filters/do_action tag characters limit
- Using a filter with multiple parameters and $this
- Insert term when page is published – avoid duplicates after edits
- How to modify core when there is no hook?
- When does a function assigned to the content_filtered_edit_pre filter hook fire?
- Capture post content before page renders
- Remove_action does not work
- How to remove action with slashes and arrows?
- Better extend a class or use add filter/action hooks?
- Add content as soon starts
- Adaptive product filters for WooCommerce
- Make an array filterable per hook
- Changing WordPress core without hacking core
- Link to Shop-Filter with .current-menu-item
- Adding a Clone link to product attributes – post_row_actions() filter, or how to override a Class question
- Customize title, description and focused keyword [closed]
- Comment search plugin
- Plugin options, presets and filters : can you help me improve my workflow?
- how to customize rss feed tags using hooks?
- How can I replace an oEmbed URL in post with actual embed HTML
- Wrapping my head around add_filter
- Detect when gutenberg editor title is available in Dom after editor load
- Replacing a deprecated filter ‘woocommerce_get_price’ with ‘woocommerce_product_get_price’
- Is it possible to bind a function to a filter hook via Ajax?
- (Woocommerce) Order by price when entering specific category
- Change custom post type GUID in RSS
- filter hook to load a different post/page on current post/page
- Sorting products by price ( regular + sale price )
- Remove tags without a specific meta key from “choose from the most used tags”
- WooCommerce coupon hook argument NULL when using filter woocommerce_get_shop_coupon_data
- How can I edit comment meta value before it is saved?
- How To Get Search Term and Use in Function
- Action hook to control access to certain parts of my site
- Where exactly does the edit_{taxonomy} hook fire?
- Is there any reason for the nested filters to be applied on the first case and not in the second one?
- Display custom product option in admin order details
- Filter Media by attached page or blog post in Library
- How do I add a line break to a string that is output by PHP?
- Variation prices breakdown only for single product page
- style_loader_tag not changing stylesheet to preload
- Right filter for rewriting page statuscode
- Add filter return false not working
- Security question – Display a General Custom Login Error Message
- Add suffix to price html does not work
- Filter wp_mail based on content type
- get_the_archive_title hook unwanted changes!
- How to filter wp_get_recent_posts() to only posts that have thumbnails?
- Put data in my-account/view-order/id/ page
- Hook inside a hook
- Adding user filter – Not updating data in URL
- How to check which submission button was clicked?
- WP Dashboard -> Posts-> Filter by Category -> Form Method Change : Which Hook
- Hide H1 Title using the_title filter
- Add class to all parent elements inside the_content
- How to add custom checkout field in user details mail template
- Getting entry ID from frm_email_message filter in formidable
- Auto append text after the title?
- Better way to change the default password reset url with the woocommerce one?
- Hooking/Filtering theme name to add theme directory
- Replacing text using add_filter
- Add second price option based on payment method at cart item price
- Passing value from one hook to another
- Change password reqts with NO plugin without breaking resetpass link?