The wpseo_breadcrumb_links filter lets you add, remove or reorder items in the Yoast SEO breadcrumbs trail. A common case is adding a link to the blog right after the Home link on single posts, so the trail reads Home › Blog › Post title.
To remove the breadcrumb structured data instead, see remove Yoast breadcrumbs schema. To turn off all of Yoast’s schema, see disable Yoast SEO schema.
The Code
Add this to your child theme’s functions.php file or to a custom plugin. Change the URL and text to match your blog page:
function yoast_seo_breadcrumb_append_link( $links ) {
if ( ! is_singular( 'post' ) ) {
return $links;
}
$breadcrumb[] = array(
'url' => home_url( '/blog/' ),
'text' => 'Blog',
);
array_splice( $links, 1, 0, $breadcrumb );
return $links;
}
add_filter( 'wpseo_breadcrumb_links', 'yoast_seo_breadcrumb_append_link' );
How It Works
Yoast passes the whole trail to wpseo_breadcrumb_links as an array, just before it renders it. Index 0 is the Home link and the last item is the current page.
Each item is an array with url and text. Yoast adds an extra key that tells you what the item is: id for posts and pages, term_id and taxonomy for terms, and ptarchive for post type archives.
array_splice( $links, 1, 0, $breadcrumb ) inserts the new item at position 1, right after Home, without removing anything. The third argument must be 0. Any other value, such as -2, silently deletes items from longer trails.
The is_singular( 'post' ) check limits the change to blog posts. Without it, the Blog link would also show up on the home page, on regular pages and on archives.
The same array feeds both the visible trail and Yoast’s BreadcrumbList schema, so your new item appears in the structured data too.
Check the Built-in Setting First
If the homepage is a static page and a Posts page is set under Settings > Reading, you may not need code at all.
Under Yoast SEO > Settings > Advanced > Breadcrumbs, Show blog page in breadcrumbs adds that page to the trail on single posts.
Use the filter when there’s no Posts page (for example, a blog index built as a custom page template), or when you need a link the settings don’t offer.
More wpseo_breadcrumb_links Examples
This version adds a hub page before the current item on a custom post type. A negative offset counts from the end, so -1 puts it right before the last crumb:
add_filter( 'wpseo_breadcrumb_links', function( $links ) {
if ( ! is_singular( 'snippet' ) ) {
return $links;
}
$new_crumb = array(
array(
'url' => home_url( '/resources/' ),
'text' => 'Resources',
),
);
array_splice( $links, -1, 0, $new_crumb );
return $links;
} );
This one removes category crumbs from the trail:
add_filter( 'wpseo_breadcrumb_links', function( $links ) {
foreach ( $links as $i => $link ) {
if ( isset( $link['taxonomy'] ) && 'category' === $link['taxonomy'] ) {
unset( $links[ $i ] );
}
}
return array_values( $links );
} );
A few rules keep the filter safe:
- Always return an array. Anything else is ignored, and Yoast logs a “doing it wrong” notice.
- Give every item both
url and text. If one is missing, Yoast drops the BreadcrumbList schema for that page.
- Yoast prints
text as-is, so wrap dynamic values like post titles in esc_html().
For a broader look at breadcrumb options, read how to add breadcrumbs to WordPress sites. The filter itself is defined in Yoast’s breadcrumbs generator source.
FAQs
Common questions about the wpseo_breadcrumb_links filter:
Does wpseo_breadcrumb_links change the breadcrumb schema too?
Yes. Yoast builds both the HTML trail and the BreadcrumbList JSON-LD from the filtered array. Filters like wpseo_breadcrumb_single_link and wpseo_breadcrumb_output only change the HTML.
Is there a Yoast breadcrumbs shortcode?
Yes, [wpseo_breadcrumb]. In PHP templates use yoast_breadcrumb( '<p id="breadcrumbs">', '</p>' ), which only prints when "Enable breadcrumbs for your theme" is on or the theme declares support for it. The filter applies to all of them.
Why is my new breadcrumb item not showing?
Check that your condition matches the page (for example is_singular( 'post' ) won't run on pages), that the function returns $links, and purge any page cache. Also confirm the trail on the page actually comes from Yoast and not from your theme or WooCommerce.