Rank Math Breadcrumbs Without the Current Page
Drops the last item (the page being viewed) from the Rank Math breadcrumb trail, leaving only the links that lead to it.
Opens WPIDE on
Code
add_filter( 'rank_math/frontend/breadcrumb/items', function ( $crumbs ) {
if ( is_array( $crumbs ) && count( $crumbs ) > 1 && ! is_front_page() ) {
array_pop( $crumbs );
}
return $crumbs;
} );
Notes
Rank Math also has a "Hide Post Title" option for posts; this works on every page type.
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.