Guide

Breadcrumbs

Displays a breadcrumb navigation trail showing the hierarchical path to the current page.

Block Metadata

PropertyValue
Nameprc-block/breadcrumbs
TitleBreadcrumbs
Categorytheme
Version1.0.0
API3
Textdomainbreadcrumbs
ExampleYes (separator, home/index crumbs — inserter preview)

Attributes

AttributeTypeDefaultDescription
contentJustificationstringHorizontal alignment of the breadcrumb trail: left, center, or right.
separatorstring">"The character displayed between breadcrumb items.
showCurrentPageTitlebooleanfalseWhether to display the current page as the last breadcrumb.
showLeadingSeparatorbooleanfalseWhether to show a separator before the first breadcrumb item.
showHomebooleantrueWhether to display the home crumb.
homeCrumbobjectConfiguration for the home breadcrumb. Properties: id, url, text, asIcon (boolean). When asIcon is true the block renders a house icon.
showIndexbooleantrueWhether to display the index/section crumb.
indexCrumbobjectConfiguration for the index breadcrumb. Properties: id, url, text.
crumbsarrayAuthored trail links after the index crumb. Each has: id, url, text, is_current_page, optional asIcon, and optional nested crumbs for a dropdown.
styleobject{ spacing: { blockGap: { left: "var:preset|spacing|50" } } }Default horizontal spacing between breadcrumb items.

Supports

FeatureEnabledNotes
AnchorYes
HTML editingNo
Color: backgroundYes
Color: textYes
Color: linkYes
Color: headingYes
Spacing: blockGapYes (horizontal only)Controls spacing between breadcrumb items
Spacing: marginYes (top, bottom only)
Spacing: paddingYes (default control)
Typography: fontSizeYes (default control)
Typography: fontFamilyYes (default control)
Border: color, style, widthYes (all default controls)
InteractivityYesDropdown crumbs use prc-block/breadcrumbs

Context

ContextDescription
postIdCurrent post ID.
postTypeCurrent post type.
queryQuery context.
queryIdQuery loop ID.
previewPostTypePreview post type in the editor.

Usage Instructions

  1. Insert the Breadcrumbs block, typically in a site template header area.
  2. Configure the home crumb text and URL in the sidebar controls.
  3. Optionally configure an index/section crumb (e.g., "Research" linking to a topic index).
  4. Toggle showCurrentPageTitle to include or exclude the current page in the trail.
  5. Choose a separator character (defaults to >).
  6. Adjust content justification (left, center, right) as needed.
  7. Optionally toggle Show home as icon to render a house icon instead of home text.
  8. Add extra Trail links after the index crumb when a project needs a fixed prefix such as Research Topics > Religion > Interactive.
  9. 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:

  1. Determines the current queried object type (WP_Post, WP_Term, WP_Post_Type, WP_User).
  2. For attachment pages, redirects to the parent post for breadcrumb generation.
  3. For hierarchical post types (pages), walks up the ancestor chain using get_ancestors().
  4. For non-hierarchical post types (posts, reports), uses the primary term in the category taxonomy via \PRC\Platform\get_primary_term_id() and walks up the term hierarchy.
  5. For taxonomy terms, walks up the term ancestor chain.
  6. Constructs the breadcrumb array: home crumb (text or house icon), index crumb, authored crumbs, ancestors, and optionally the current page.
  7. Applies the prc_platform_breadcrumbs filter 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.
  8. Renders each crumb as a link, a button (dropdown with no URL), or a span. Separators sit between items.
  9. A crumb with a nested crumbs array 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, indexCrumb block attributes) are merged after the cache lookup and are not part of the cached trail payload.
  • Invalidation: prc_platform_on_update bumps the version for the updated post; edited_term bumps the version for the edited term and, for category terms, 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:

FieldTypeMeaning
urlstringDestination. Empty or null renders a span or a dropdown button.
textstringVisible label. HTML is allowed so existing icon markup keeps working.
asIconbooleanWhen true, the block renders a house icon and uses text as the accessible name.
is_current_pagebooleanMarks the current location (aria-current="page").
visiblebooleanWhen false the crumb is skipped in the visible trail (Schema.org use).
crumbsarrayNested 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-gap CSS 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 the is-open class. They are absolute-positioned menus with a white background, box shadow, rounded corners, and a max height for long country lists.

This block is standalone. It is typically used in site-wide templates alongside navigation blocks.

Was this helpful?