Tutorials
Elementor
Build your website with Elementor — no code needed
16 tutorials
WordPress
Learn how to build a professional website on WordPress
14 tutorials
AWS Lightsail
Beginner-friendly AWS Lightsail guides
12 tutorials
View all tutorials →
Tools
Website Platforms & Tools
Tools to build, host, and optimize fast, reliable, and professional websites.
8 tools
Web Hosting Providers
Fast, secure web hosting with reliable uptime to power and scale your website.
7 tools
VoIP / Communications
Business phone tools with virtual numbers, call routing, and auto-attendants for a professional pres
4 tools
Website Security
Security tools to protect your site from threats, malware, and unauthorized access.
2 tools
Branding & Logo Design
Create a strong brand identity with custom logo and professional design services.
1 tool
View all tools →

How to Display WordPress Category Breadcrumbs (Parent > Child)

Gerry Manzari Written by Gerry Manzari · March 8, 2026 · 2 min read

By default, WordPress displays categories in a format like Cats, Pets, even when one category is a child of another. In this guide, you’ll learn how to display categories in the correct hierarchy format like Pets > Cats, with clickable links.

Step 1: Add Code

Add the following code to your functions.php file or insert it using a plugin like Code Snippets.

PHP
function manzari_category_hierarchy() {
    $categories = get_the_category();
    if (empty($categories)) return '';

    $cat = $categories[0];

    if ($cat->parent) {
        $parent = get_category($cat->parent);

        return '<span class="post-cats">
        <a href="' . get_category_link($parent->term_id) . '">' . $parent->name . '</a>
        >
        <a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a>
        </span>';

    } else {
        return '<span class="post-cats">
        <a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a>
        </span>';
    }
}

add_shortcode('post_cat_hierarchy', 'manzari_category_hierarchy');

This code creates a shortcode that outputs your categories in a Parent > Child format.

Step 2: Add the Shortcode to Your Page or Template

Now that the shortcode exists, you need to display it on your site.

Add the following shortcode anywhere you want the category hierarchy to appear:

PLAINTEXT
[post_cat_hierarchy]

If you are using Elementor, simply add a Shortcode widget and paste the shortcode there.

Step 3: Add the CSS Styling

Add the following CSS to Appearance → Customize → Additional CSS or your theme’s stylesheet.

CSS
.post-cats {
color: #ffffff;
font-size: 16px;
font-weight: 500;
letter-spacing: 0.5px;
}

.post-cats a {
color: #ffffff !important;
text-decoration: none;
font-size: 16px;

}

.post-cats a:hover {
text-decoration: underline;
}.post-cats {
color: #ffffff;
font-size: 16px;
font-weight: 500;
letter-spacing: 0.5px;
}

.post-cats a {
color: #ffffff !important;
text-decoration: none;
}

.post-cats a:hover {
text-decoration: underline;
}

This styles the category links and ensures they match your design.

Final Result

Your categories will now display in a clean breadcrumb-style format like this:

PLAINTEXT
Pets > Cats

Keep Reading

Tools We Recommend

Recommended Tools

Shopify

Shopify is one of the most powerful all-in-one eCommerce platforms available today, designed to help anyone—from beginners to…

4.7
Updraft

UpdraftPlus Review – The Easiest Way to Back Up Your WordPress Website If you’re running a WordPress site…

4.7
Free / Pro from $70/yr (2 sites)
Zillion Designs

At Manzari.com, we’ve been using Zillion Designs since 2015 as our go-to platform for logo design and brand…

4.5
From $199 (+ 20% processing fee)

Affiliate links — we may earn a commission at no extra cost to you.