How to Create Custom Taxonomy Breadcrumb Navigation in WordPress

Snippets by IsItWP

Are you looking for a way to create custom taxonomy breadcrumb navigation in WordPress? While there’s probably a plugin for this, we have created a quick code snippet that you can use to create custom taxonomy breadcrumb navigation in WordPress.


All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

function show_breadcrumb($name,$type){
    $list = "";
    $home = get_bloginfo("home");
    if ($type && $name){
        $ans = get_term_by('name', $name, $type);
        while ($parentID > 0){
            $parent = get_term_by('id', $parentID, $type);
            $url = $home."/".$type."/".$parent->slug;
            $list = "<li><a href='".$url."'>".$parent->name."</a></li>".$list;
            $parentID = $parent->parent;
        $url = $home."/".$type."/".$ans->slug;
        $list = $list."<li>".$ans->name."</li>";
    if ($list) echo "<ul><li><a href='$home'>Home</a></li>".$list."</ul>";
// Format
<?php show_breadcrumb("term-name","taxonomy"); ?> 
// To list breadcrumbs of "Catalog" taxonomy.
<?php show_breadcrumb(single_tag_title("", false),"catalog"); ?>

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 23 effective tips to get more email subscribers and how to create a WordPress form with a date picker.

Comments   Leave a Reply

  1. You can user Yoast SEO’s built-in breadcrumbs functionality.
    YoastSEO>Search Appearance>Breadcrumbs>Taxonomy to show in breadcrumbs for content types and choose the custom taxonomy created with pods.

  2. Thanks so much!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!