Remove current page from WP Genesis breadcrumbs

How can I remove the current page from the breadcrumbs trail on a Genesis WordPress site? I’ve examined breadcrumb.php top to bottom, but am not sure which filter(s) I should hook into.

Thanks!

Related posts

Leave a Reply

3 comments

  1. Bill Erickson has a snippet to remove the post title. This may be worth a shot to remove the current page title as well:

    function be_remove_title_from_single_crumb( $crumb, $args ) {
        return substr( $crumb, 0, strrpos( $crumb, $args['sep'] ) );
    }
    add_filter( 'genesis_single_crumb', 'be_remove_title_from_single_crumb', 10, 2 );
    

    http://www.billerickson.net/code/remove-post-title-from-breadcrumb/

    I’m suprised there isn’t more information out there about this.

  2. But if you use Genesis Connect for WooCommerce plugin (to use WooCommerce with your Genesis site) and you need to remove the current page from the breadcrumbs from your products pages you need to do this:

    function remove_title_from_single_product_crumb( $crumb, $args ) {
        return substr( $crumb, 0, strrpos( $crumb, $args['sep'] ) );
    }
    add_filter( 'gencwooc_single_product_crumb', 'remove_title_from_single_product_crumb', 10, 2 );
    
  3. To remove specifically from pages, use 'genesis_page_crumb' filter with the same logic:

    function be_remove_title_from_single_crumb( $crumb, $args ) {
        return substr( $crumb, 0, strrpos( $crumb, $args['sep'] ) );
    }
    add_filter( 'genesis_page_crumb', 'be_remove_title_from_single_crumb', 10, 2 );
    

    You can also experiment with 'genesis_build_crumbs' filter that accepts $crumbs array and default breadcrumbs arguments array $args. It’s used in Genesis Breadcrumbs class build_crumbs() method (more info here).