Skip to content
WordPress Core

WordPress 7.0: Breadcrumb Block Filters Offer Custom Control

WordPress 7.0's Breadcrumbs block enhances site navigation with new filters for custom control, offering developers flexibility in breadcrumb trail output.

WordPress 7.0: Breadcrumb Block Filters Offer Custom Control

WordPress 7.0 introduces a crucial update for theme developers with the new Breadcrumbs block, enhancing site navigation capabilities significantly. This feature, part of the extensive updates in the Gutenberg plugin, allows developers to insert a single Breadcrumbs block within a theme’s header, automatically adjusting to reflect the site’s navigation hierarchy.

The Breadcrumbs block is designed to improve user experience by providing a clear path back through the site’s structure. This is particularly useful for websites with complex hierarchies. Within the Twenty Twenty-Five theme, for example, the block demonstrates its utility in a child page setting, displaying the trail effectively.

Control Over Breadcrumb Trail Output

Developers now have two new filters to fine-tune the breadcrumb trail output. The first, block_core_breadcrumbs_items, provides the capability to modify, add, or remove items from the breadcrumb trail just before rendering. Each breadcrumb item is structured as an array containing a label, an optional URL, and an optional HTML allowance setting. The filter allows for significant customization, such as prepending custom breadcrumb items, which can enhance navigation pathways tailored to specific site needs.

breadcrumb block filters
Developers gain new control over breadcrumb trails in WordPress 7.0. — Photo: Szabó Viktor / Pexels

The second filter, block_core_breadcrumbs_post_type_settings, offers control over which taxonomy and terms appear in the breadcrumb trail for posts using taxonomy-based breadcrumbs. This is particularly useful for posts with multiple taxonomies or terms, enabling developers to specify preferred taxonomies and terms, or to allow fallback behavior when preferred terms are absent. The filter can be applied to both non-hierarchical and hierarchical post types, depending on advanced block settings.

Why Breadcrumb Block Filters Matter

The introduction of these filters marks a significant step in providing developers with the flexibility needed to create highly customized navigation experiences. By allowing granular control over breadcrumb trails, developers can enhance SEO and user engagement by ensuring that navigation paths are logical and intuitive.

For instance, a developer can configure the breadcrumb trail to prioritize displaying categories over tags in a blog post, or set a preferred term for product pages in an e-commerce site. This level of control can lead to more meaningful interactions as users navigate through content-rich sites.

What To Do

  • Theme Developers: Experiment with the new breadcrumb filters to tailor the navigation experience. Consider how breadcrumb trails might enhance user navigation and SEO.
  • Plugin Authors: Test compatibility with the new breadcrumb block filters to ensure seamless integration with existing plugins.
  • Site Operators: If using themes that leverage the Breadcrumbs block, review and adjust breadcrumb settings to align with your site’s navigation strategy.

Related Coverage