Home / Admin / Remove the crumb for the ‘uncategorized’ category
Duplicate Snippet

Embed Snippet on Your Site

Remove the crumb for the ‘uncategorized’ category

This snippet can be used to remove the crumb for the ‘uncategorized’ category

<10
Code Preview
php
<?php
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;
}

Comments

Add a Comment