Support » Plugin: Yoast SEO » Add a link to the Yoast SEO breadcrumbs but multilingual

  • Resolved jmpotthoff

    (@jmpotthoff)


    I´m using Yoast to manage the breadcrumbs on our site. Them is a custom one based on Bussines Lounge. The theme has a “Team” section, which we rename as “Nosotros”, “About Us”, and “Über uns”. It is a multilingual website.

    Yoast Breadcrumbs do no shows “/Nosotros/” link on the Breadcrumbs, and it just shows “/home/team-member/”. So, we did use the code below in order to be able to add the link “/Nostros/” and have the full breadcrumb: “/home/nosotros/team-member”.

    Unfortunately, the code works fine for the “Spanish” site but does not replicate it on the german and English content. We manage the languages with WPML, and we check the that work “Nosotros” is properly translated to the other two languages.

    add_filter( 'wpseo_breadcrumb_links', 'yoast_seo_breadcrumb_append_link' );
    
    function yoast_seo_breadcrumb_append_link( $links ) {
        global $post;
    
        if ( is_single ( array( 649, 6647, 6645, 6643, 6641, 6630 ) ) ) {
            $breadcrumb[] = array(
                'url' => site_url( '/nosotros/' ),
                'text' => 'Nosotros',
            );
    
            array_splice( $links, 1, -2, $breadcrumb );
        }
    
        return $links;
    }
    • This topic was modified 11 months, 1 week ago by jmpotthoff.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add a link to the Yoast SEO breadcrumbs but multilingual’ is closed to new replies.