Skip to content

Instantly share code, notes, and snippets.

@mikaelz
Created March 31, 2018 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikaelz/a8e7ca600e99ddd5b5ea82d7096bd647 to your computer and use it in GitHub Desktop.
Save mikaelz/a8e7ca600e99ddd5b5ea82d7096bd647 to your computer and use it in GitHub Desktop.
Remove Products list item from Breadcrumb NavXT
/**
* Remove products breadcrumb
*
* @param object $breadcrumb_obj Breadcrumb object.
*/
function my_bcn_after_fill( $breadcrumb_obj ) {
if ( is_category() || is_tag() || is_tax() ) {
foreach ( $breadcrumb_obj->breadcrumbs as $key => $item ) {
if ( 'Products' === $item->get_title() ) {
unset( $breadcrumb_obj->breadcrumbs[ $key ] );
}
}
}
}
add_action( 'bcn_after_fill', 'my_bcn_after_fill' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment