Remove Element From the Yoast SEO Breadcrumbs

WordPressPosted on

With Yoast SEO, we can use an excellent and straightforward helper function for creating breadcrumbs (yoast_breadcrumb()).

Under the Search Appearance -> Breadcrumbs menu, we can customize it too. Besides this, there can be use cases where you want to remove something from the generated list of links (like a page of the custom post type archive); you can do it like so:

 * Remove "Positions" from breadcrumbs
function pine_remove_yoast_breadcrumb_link($link_output , $link)
    $text_to_remove = 'Positions';

    if($link['text'] == $text_to_remove) {
      $link_output = '';

    return $link_output;
add_filter('wpseo_breadcrumb_single_link' ,'pine_remove_yoast_breadcrumb_link', 10 ,2);

Inside the $link attribute, we can access the url, text, and ID of the link. The $link_output contains the whole displayed link; if we want to delete a link, we have to set this to empty.

Need a web developer? Maybe we can help, get in touch!

Similar Posts

More content in WordPress category