Displays a breadcrumb navigation trail showing the hierarchical path to the current page.
Block Metadata
| Property | Value |
|---|---|
| Name | prc-block/breadcrumbs |
| Title | Breadcrumbs |
| Category | theme |
| Version | 1.0.0 |
| API | 3 |
| Textdomain | breadcrumbs |
| Example | Yes (separator, home/index crumbs — inserter preview) |
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
contentJustification | string | — | Horizontal alignment of the breadcrumb trail: left, center, or right. |
separator | string | ">" | The character displayed between breadcrumb items. |
showCurrentPageTitle | boolean | false | Whether to display the current page as the last breadcrumb. |
showLeadingSeparator | boolean | false | Whether to show a separator before the first breadcrumb item. |
showHome | boolean | true | Whether to display the home crumb. |
homeCrumb | object | — | Configuration for the home breadcrumb. Properties: id, url, text, asIcon (boolean). When asIcon is true the block renders a house icon. |
showIndex | boolean | true | Whether to display the index/section crumb. |
indexCrumb | object | — | Configuration for the index breadcrumb. Properties: id, url, text. |
crumbs | array | — | Authored trail links after the index crumb. Each has: id, url, text, is_current_page, optional asIcon, and optional nested crumbs for a dropdown. |
style | object | { spacing: { blockGap: { left: "var:preset|spacing|50" } } } | Default horizontal spacing between breadcrumb items. |
Supports
| Feature | Enabled | Notes |
|---|---|---|
| Anchor | Yes | |
| HTML editing | No | |
| Color: background | Yes | |
| Color: text | Yes | |
| Color: link | Yes | |
| Color: heading | Yes | |
| Spacing: blockGap | Yes (horizontal only) | Controls spacing between breadcrumb items |
| Spacing: margin | Yes (top, bottom only) | |
| Spacing: padding | Yes (default control) | |
| Typography: fontSize | Yes (default control) | |
| Typography: fontFamily | Yes (default control) | |
| Border: color, style, width | Yes (all default controls) | |
| Interactivity | Yes | Dropdown crumbs use prc-block/breadcrumbs |
Context
| Context | Description |
|---|---|
postId | Current post ID. |
postType | Current post type. |
query | Query context. |
queryId | Query loop ID. |
previewPostType | Preview post type in the editor. |
Usage Instructions
- Insert the Breadcrumbs block, typically in a site template header area.
- Configure the home crumb text and URL in the sidebar controls.
- Optionally configure an index/section crumb (e.g., "Research" linking to a topic index).
- Toggle
showCurrentPageTitleto include or exclude the current page in the trail. - Choose a separator character (defaults to
>). - Adjust content justification (left, center, right) as needed.
- Optionally toggle Show home as icon to render a house icon instead of home text.
- Add extra Trail links after the index crumb when a project needs a fixed prefix such as Research Topics > Religion > Interactive.
- The rest of the trail is generated from the post hierarchy or taxonomy unless a plugin replaces it.
Block Markup Example
<nav
class="wp-block-prc-block-breadcrumbs is-content-justification-left"
id="breadcrumbs-abc123"
aria-label="Breadcrumbs"
style="--breadcrumbs-gap: 1em;"
>
<div class="prc-block-breadcrumbs__list">
<div class="prc-block-breadcrumbs__item">
<a href="/"><span>Home</span></a>
</div>
<span class="prc-block-breadcrumbs__separator" aria-hidden="true"
>></span
>
<div class="prc-block-breadcrumbs__item">
<a href="/research/"><span>Research</span></a>
</div>
<span class="prc-block-breadcrumbs__separator" aria-hidden="true"
>></span
>
<div class="prc-block-breadcrumbs__item">
<a href="/research/topic/" aria-current="page"
><span>Current Page</span></a
>
</div>
</div>
</nav>
PHP Rendering
The render_block_callback in class-breadcrumbs.php is fully server-side rendered. It:
- Determines the current queried object type (
WP_Post,WP_Term,WP_Post_Type,WP_User). - For attachment pages, redirects to the parent post for breadcrumb generation.
- For hierarchical post types (pages), walks up the ancestor chain using
get_ancestors(). - For non-hierarchical post types (posts, reports), uses the primary term in the
categorytaxonomy via\PRC\Platform\get_primary_term_id()and walks up the term hierarchy. - For taxonomy terms, walks up the term ancestor chain.
- Constructs the breadcrumb array: home crumb (text or house icon), index crumb, authored
crumbs, ancestors, and optionally the current page. - Applies the
prc_platform_breadcrumbsfilter so other plugins can replace or extend the list. The filter takes one argument. A second argument would break Religious Landscape Study, which uses that slot as a Schema.org flag. - Renders each crumb as a link, a button (dropdown with no URL), or a span. Separators sit between items.
- A crumb with a nested
crumbsarray is a dropdown. The trigger shows a caret. Click the trigger (or press Enter/Space) to toggle the menu. Hover does not open it.
Object cache
Trail assembly (ancestor lookups and taxonomy walks) is cached in the prc_breadcrumbs object cache group with a 1-hour TTL. Caching applies only for logged-out, non-preview requests.
- Cache key includes a version token per queried object (
post:{id},term:{id}, etc.). - Home and index crumbs (
homeCrumb,indexCrumbblock attributes) are merged after the cache lookup and are not part of the cached trail payload. - Invalidation:
prc_platform_on_updatebumps the version for the updated post;edited_termbumps the version for the edited term and, forcategoryterms, for the primary category used in post trails.
Core Breadcrumbs Disabled
The PHP class filters allowed_block_types_all to remove yoast-seo/breadcrumbs and core/breadcrumbs from the block inserter.
Crumb record
Plugins that hook prc_platform_breadcrumbs should return this shape:
| Field | Type | Meaning |
|---|---|---|
url | string | Destination. Empty or null renders a span or a dropdown button. |
text | string | Visible label. HTML is allowed so existing icon markup keeps working. |
asIcon | boolean | When true, the block renders a house icon and uses text as the accessible name. |
is_current_page | boolean | Marks the current location (aria-current="page"). |
visible | boolean | When false the crumb is skipped in the visible trail (Schema.org use). |
crumbs | array | Nested crumb records. Presence turns this crumb into a dropdown. |
Religious Projections replaces the trail on its routes with a home icon, the Research Topics > Religion > Interactive prefix, then a collection dropdown (Religions, Regions, or the parent region) and the current entity.
Frontend Interactivity
Dropdown crumbs use the Interactivity API store prc-block/breadcrumbs. Click the caret or unlabeled trigger to toggle. Escape dismisses the menu. A click outside also closes it. Clicking a submenu link closes the menu before navigation. The list is visible only while the crumb has the is-open class.
Styles
Key CSS behaviors:
- The breadcrumb list is a wrapping flex row. Overflow is visible so dropdowns are not clipped.
- Items are spaced using the
--breadcrumbs-gapCSS custom property. - The current page (
a[aria-current="page"]) is displayed in bold. - Sub-lists (
.prc-block-breadcrumbs__sub_list) are hidden by default and shown only when the crumb has theis-openclass. They are absolute-positioned menus with a white background, box shadow, rounded corners, and a max height for long country lists.
Related Blocks
This block is standalone. It is typically used in site-wide templates alongside navigation blocks.