Remove the Current Page From All in One SEO Breadcrumbs
Drops the final crumb (the current page) from the All in One SEO breadcrumb trail.
Opens WPIDE on
Code
add_filter( 'aioseo_breadcrumbs_trail', function ( $crumbs ) {
if ( is_array( $crumbs ) && count( $crumbs ) > 1 && ! is_front_page() ) {
array_pop( $crumbs );
}
return $crumbs;
} );
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.