Remove the Current Page From Yoast Breadcrumbs
Drops the last item (the page you are on) from the Yoast SEO breadcrumb trail, so the trail only shows the path leading to it.
Opens WPIDE on
Code
add_filter( 'wpseo_breadcrumb_links', function ( $links ) {
if ( is_array( $links ) && count( $links ) > 1 && ! is_front_page() ) {
array_pop( $links );
}
return $links;
} );
Notes
The homepage keeps its single crumb.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.