WordPress Tricks

Yoast breadcrumb add Product or any Text with links just after Home text

yoast breadcrumb add Product or any Text with links just after Home text

Please add the following code to your theme’s function.php

add_filter( 'wpseo_breadcrumb_links', 'yoast_seo_breadcrumb_add_link' );

function yoast_seo_breadcrumb_add_link( $links ) {
    global $post;

    
        $breadcrumb[] = array(
            'url' => site_url( '/products/' ),
            'text' => 'Products',
        );
 
        array_splice( $links, 1, 0, $breadcrumb );
     

    return $links;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s