Notice: There is no legacy documentation available for this item, so you are seeing the current documentation.
Purpose
This filter can be used to change, add or remove any crumb in the breadcrumbs trail.
Arguments (1)
- $crumbs (array) – An array of crumbs.
Example code snippet
The code snippet below is just an example of how this filter can be used. In the example below we’ll remove the crumb for the ‘uncategorized’ category.
// Remove the crumb for the uncategorized category.
add_filter( 'aioseo_breadcrumbs_trail', 'aioseo_breadcrumbs_trail' );
function aioseo_breadcrumbs_trail( $crumbs ) {
foreach ( $crumbs as $key => $crumb ) {
if ( is_a( $crumb['reference'], 'WP_Term' ) && 'uncategorized' === $crumb['reference']->slug ) {
unset( $crumbs[ $key ] );
}
}
return $crumbs;
}