wordpresswoocommercewordpress-themingbreadcrumbs

Replacing the home link in woocommerce breadcrumbs


I know its a bit of a daft question, but like a fool I just cant find the right answer.

At the moment this is what my breadcrumbs look like

Home / Male Voice overs / Derek Doyle

I need to change the home link name to Voice Overs and link it to another page.

Please any help would be great.

Thanks


Solution

  • Woocommerce provides filters for this.

    add_filter( 'woocommerce_breadcrumb_defaults', 'jk_change_breadcrumb_home_text' );
    function jk_change_breadcrumb_home_text( $defaults ) {
        // Change the breadcrumb home text from 'Home' to 'Voice Overs'
        $defaults['home'] = 'Voice Overs';
        return $defaults;
    }
    
    add_filter( 'woocommerce_breadcrumb_home_url', 'woo_custom_breadrumb_home_url' );
    function woo_custom_breadrumb_home_url() {
        return 'http://yoursite.com/voice-overs';
    }
    

    Use these filters in your functions.php file to get the desired results.

    https://docs.woocommerce.com/document/customise-the-woocommerce-breadcrumb/