Remove Yoast Breadcrumbs Schema

The Yoast SEO plugin adds a BreadcrumbList piece to its schema graph on every page. To remove the Yoast breadcrumbs schema and keep the rest of the graph, you need two filters: one drops the piece, the other removes its reference from WebPage.

This is useful when your theme or another plugin already outputs BreadcrumbList markup and Google Search Console reports duplicates, or when the trail doesn’t match your real site structure.

To switch off all of Yoast’s structured data instead, see disable Yoast SEO schema. To change the trail instead of removing it, see add a link to Yoast SEO breadcrumbs.

The Code

Add this snippet to your theme’s functions.php file (preferably in a child theme) or to a custom plugin:

add_filter( 'wpseo_schema_graph_pieces', 'remove_breadcrumbs_from_schema', 11, 2 );
add_filter( 'wpseo_schema_webpage', 'remove_breadcrumbs_property_from_webpage', 11, 1 );

/**
 * Removes the breadcrumb graph pieces from the schema collector.
 *
 * @param array  $pieces  The current graph pieces.
 * @param string $context The current context.
 *
 * @return array The remaining graph pieces.
 */
function remove_breadcrumbs_from_schema( $pieces, $context ) {
    return array_filter( $pieces, function( $piece ) {
        return ! $piece instanceof \Yoast\WP\SEO\Generators\Schema\Breadcrumb;
    } );
}

/**
 * Removes the breadcrumb property from the WebPage piece.
 *
 * @param array $data The WebPage's properties.
 *
 * @return array The modified WebPage properties.
 */
function remove_breadcrumbs_property_from_webpage( $data ) {
    if ( array_key_exists( 'breadcrumb', $data ) ) {
        unset( $data['breadcrumb'] );
    }
    return $data;
}

How It Works

wpseo_schema_graph_pieces receives the list of generator objects Yoast will run for the current page. The first function filters out the one whose class is Yoast\WP\SEO\Generators\Schema\Breadcrumb, so the BreadcrumbList is never built.

The WebPage piece still carries a breadcrumb property pointing to #breadcrumb by @id. wpseo_schema_webpage lets you edit that piece, and the second function deletes the property so the graph has no reference to a piece that no longer exists.

The code applies to every page on the site. Run both filters together: removing only one leaves either a duplicate BreadcrumbList or a broken reference.

Why the Snippet Didn’t Work

The most common cause is a class name that lost its backslashes when it was copied or saved (YoastWPSEOGeneratorsSchemaBreadcrumb). PHP doesn’t throw an error when instanceof checks against a class that doesn’t exist. It just returns false, so nothing is removed. Copy the code again from above.

If you paste the snippet through a tool that strips backslashes, use this shorter version instead. It removes the same markup through the wpseo_schema_needs_breadcrumb filter and has no class name at all:

add_filter( 'wpseo_schema_needs_breadcrumb', '__return_false' );

add_filter( 'wpseo_schema_webpage', function( $data ) {
    unset( $data['breadcrumb'] );
    return $data;
} );

Still seeing it? Purge your page cache, then view the page source and search for BreadcrumbList. If the match isn’t inside the yoast-schema-graph script, another plugin or your theme is adding it.

Schema vs. Visible Breadcrumbs

This snippet removes only the structured data. The breadcrumb trail your visitors see is a separate output, and it stays.

It works the other way too. Turning off Enable breadcrumbs for your theme under Yoast SEO > Settings > Advanced > Breadcrumbs doesn’t remove the BreadcrumbList schema, because Yoast builds that piece regardless of the setting.

To hide the visible trail, remove the yoast_breadcrumb() call, the Savvy / Snippets / Remove Yoast Breadcrumbs Schema shortcode or the breadcrumbs block from your templates.

For other ways to display breadcrumbs, including without a plugin, see how to add breadcrumbs navigation to a WordPress site. The original snippet comes from the Yoast Schema API documentation.

FAQs

Common questions about removing Yoast’s breadcrumb schema:

Will removing breadcrumb schema hurt my SEO?
Google uses breadcrumb markup to understand where a page sits in your site, so don't remove it without a reason. Do it when something else already outputs correct BreadcrumbList markup, or when Yoast's trail is wrong and you can't fix it.
Can I remove the breadcrumb schema on specific pages only?
Yes. Add a condition such as is_front_page() or is_singular( 'product' ) to both callbacks and return the original value when it doesn't match. Keep the two conditions identical.
What is the wpseo_schema_webpage filter?
It's one of Yoast's wpseo_schema_<identifier> filters. It receives the WebPage piece as an array before output, so you can add, change or remove properties like breadcrumb.
Does this also hide the breadcrumbs on my pages?
No. It only removes the JSON-LD. The visible trail comes from yoast_breadcrumb(), the shortcode or the block in your theme, and you remove it there.
Discussion
[  0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!