How to Customize Breadcrumb NavXT Hierarchies for Pages, Posts, and Custom Post Types
Content
Many WordPress users turn to the Breadcrumb NavXT plugin for robust navigation trails. A common challenge arises when the default hierarchy settings don't match a site's unique structure, especially with custom post types (CPTs), pages used as archives, or complex organizational needs. This guide explains the core concepts and provides solutions for creating the perfect breadcrumb trail.
The Core Challenge: Default vs. Desired Hierarchy
Breadcrumb NavXT primarily generates location-based breadcrumbs. This means it follows the inherent WordPress hierarchy of parent/child relationships for pages and the assigned taxonomy terms (like categories) for posts. Problems occur when your site's information architecture doesn't align with this default logic. For instance:
- Using a Page or CPT as a logical parent for other content without a true parent/child relationship.
- Wanting a post's breadcrumb to reflect how a user arrived there (path-based) rather than its category structure.
- Needing to insert a custom breadcrumb, like a "Blog" page, into a trail.
Common Scenarios and Solutions
1. Adding a Blog Page to Post Breadcrumbs
Problem: Single posts show Home > Post Title, with no link back to the main blog listing page.
Solution: This is a native WordPress feature. Navigate to Settings > Reading. Set your "Posts page" to the page you use for your blog (e.g., "Blog" or "News"). Then, in Breadcrumb NavXT's settings, ensure the "Blog Breadcrumb" option is checked. This will automatically generate the trail: Home > Blog > Post Title.
2. Forcing a Custom Parent for Posts or CPTs
Problem: You want all posts of a certain type to appear under a specific page (e.g., "Home > California > San Diego > House123"), but the parent page isn't part of the default hierarchy.
Solution: The most robust method is to use a custom taxonomy. Create taxonomies for your logical groups (e.g., "States" and "Cities"). Assign terms from these taxonomies to your posts or CPTs. In Breadcrumb NavXT's settings, under the "Post Types" tab, set the hierarchy for your custom post type to use this new taxonomy.
3. Manipulating the Breadcrumb Trail with Code
Problem: You need to manually inject, remove, or modify a breadcrumb item, such as adding an "Authors" page before an author name or showing only the first tag.
Solution: Breadcrumb NavXT provides powerful filters for customization. The following code snippet demonstrates how to use the bcn_post_terms filter to show only the first tag in a trail instead of all tags.
add_filter('bcn_post_terms', 'my_bcn_post_term_selector', 10, 3);
function my_bcn_post_term_selector($terms, $taxonomy, $id)
{
//Target a specific taxonomy, e.g., 'post_tag'
if($taxonomy === 'post_tag' && is_array($terms) && count($terms) > 1)
{
//Return only the first term
return array(0 => reset($terms));
}
return $terms;
}
For more advanced injections (like adding a breadcrumb for a "Tag Base" page), you would need to use actions like bcn_after_fill to manually insert items into the breadcrumb array. The official Breadcrumb NavXT documentation contains examples for these advanced use cases.
Important Considerations
- Hierarchical CPTs: Ensure your custom post type is registered as
'hierarchical' => true(like pages) for Breadcrumb NavXT to recognize and display parent/child relationships within that CPT. - Path vs. Location: Breadcrumb NavXT creates location-based trails. It cannot natively create path-based trails (showing the exact click path a user took to arrive on a page) without significant custom development, as this requires tracking user session history.
- Multiple Parents: WordPress does not support a page or post having multiple parents. If you need a single piece of content to appear in multiple breadcrumb trails, you typically need to use taxonomy terms to define those relationships or explore specialized add-ons.
By understanding the difference between WordPress's inherent content relationships and your desired navigational structure, you can effectively use Breadcrumb NavXT's settings and filters to build intuitive and helpful breadcrumb trails for your visitors.
Related Support Threads Support
-
Noob question: GSC show 2 breadcrumb schemas for each post.https://wordpress.org/support/topic/noob-question-gsc-show-2-breadcrumb-schemas-for-each-post/
-
Breadcrumb on Multisite – Hide main site hierarchyhttps://wordpress.org/support/topic/breadcrumb-on-multisite-hide-main-site-hierarchy/
-
Breadcrumb add folderhttps://wordpress.org/support/topic/breadcrumb-add-folder/
-
How to make breadcrumbs to link to a post (not current post title)?https://wordpress.org/support/topic/how-to-make-breadcrumbs-to-link-to-a-post-not-current-post-title/
-
Breadcrumb NavXT Settings & Post Hierarchyhttps://wordpress.org/support/topic/breadcrumb-navxt-settings-post-hierarchy/
-
CPT Hierarchy Issuehttps://wordpress.org/support/topic/cpt-hierarchy-issue/
-
Using page hierarchy rather than category pagehttps://wordpress.org/support/topic/using-page-hierarchy-rather-than-category-page/
-
Feature Request: Additional “Custom Root” pages…https://wordpress.org/support/topic/feature-request-additional-custom-root-pages/
-
Category trails: extra page & child page crumbs appearinghttps://wordpress.org/support/topic/category-trails-extra-page-child-page-crumbs-appearing/
-
Back link | Link to previous pagehttps://wordpress.org/support/topic/back-link-link-to-previous-page/
-
Referring page, posts in multiple catagorieshttps://wordpress.org/support/topic/posts-in-multiple-catagories/
-
Hierarcy questionhttps://wordpress.org/support/topic/hierarcy-question/
-
Set custom Breadcrumbs paths. Manually / rule based?https://wordpress.org/support/topic/set-custom-breadcrumbs-paths-manually-rule-based/
-
Specify custom parent for a CPThttps://wordpress.org/support/topic/specify-custom-parent-for-a-cpt/
-
Custom hierarchyhttps://wordpress.org/support/topic/custom-hierarchy-1/
-
Manage Breadcrumbs Linkshttps://wordpress.org/support/topic/manage-breadcrumbs-links/
-
Breadcrumb trail even without actual page hierarchyhttps://wordpress.org/support/topic/breadcrumb-trail-even-without-actual-page-hierarchy/
-
Breadcrumbs when using tagshttps://wordpress.org/support/topic/breadcrumbs-when-using-tags/
-
Breadcrumb NavXT hierarchyhttps://wordpress.org/support/topic/breadcrumb-navxt-hierarchy/
-
Add First Item to trailhttps://wordpress.org/support/topic/add-first-item-to-tra-trail/
-
Custom Breadcrumb for Archive Pagehttps://wordpress.org/support/topic/custom-breadcrumb-for-archive-page/
-
breadcrumbs history based ?https://wordpress.org/support/topic/breadcrumbs-history-based-2/
-
Display breadcrumb based on full heirarchy, not current place in heirarchyhttps://wordpress.org/support/topic/display-breadcrumb-based-on-full-heirarchy-not-current-place-in-heirarchy/
-
Full trail not shown?https://wordpress.org/support/topic/full-trail-not-shown/
-
How to make some post as parent to other postshttps://wordpress.org/support/topic/how-to-make-some-post-as-parent-to-other-posts/
-
Archive Landing Page, no subfolders, custom breadcrumbs, SEOhttps://wordpress.org/support/topic/archive-landing-page-no-subfolders-custom-breadcrumbs-seo/
-
How to include a linked page before postname?https://wordpress.org/support/topic/how-to-include-a-linked-page-before-postname/
-
Set breadcrumbs to link to posts rather than categorieshttps://wordpress.org/support/topic/set-breadcrumbs-to-link-to-posts-rather-than-categories/
-
Breadcrumbs when pages linked to by multiple "hierarchical" pageshttps://wordpress.org/support/topic/breadcrumbs-when-pages-linked-to-by-multiple-hierarchical-pages/
-
Pages + CPThttps://wordpress.org/support/topic/pages-cpt/
-
Link in the breadcrumb trail for posts that are not affected by Post Hierarchyhttps://wordpress.org/support/topic/link-in-the-breadcrumb-trail-for-posts-that-are-not-affected-by-post-hierarchy/
-
adding tag base to breadcrumbshttps://wordpress.org/support/topic/adding-tag-base-to-breadcrumbs/
-
add post name to an existing breadcrumbhttps://wordpress.org/support/topic/add-post-name-to-an-existing-breadcrumb/
-
Hierarchical custom post type help neededhttps://wordpress.org/support/topic/hierarchical-custom-post-type-help-needed/
-
Basic (I hope) questionhttps://wordpress.org/support/topic/basic-i-hope-question/
-
Multiple parents for a pagehttps://wordpress.org/support/topic/multiple-parents-for-a-page/