I am using this code in my functions.php file to display breadcrumbs on my web site..

function the_breadcrumb() {
            if (!is_home()) {
                    echo '<a href="';
                    echo get_option('home');
                    echo '">';
                    echo 'Home';
                    echo "</a> » ";
                    if (is_category() || is_single()) {
                            if (is_single()) {
                                    echo " » ";
                    } elseif (is_page()) {
                            echo the_title();

I would like to know how to modify this so that only Parent categories are displayed? I have lots of posts that are assigned to multiple sub categories so the breadcrumb trail can get huge!

Can anyone help?

1 Answer 1


Here's a suggestion: Yoast's SEO plugin is practically a must for a WordPress site, and has a breadcrumb implementation baked in.

  • Good call Chris, after trying lots of different solutions none of them were as efficient as Yoasts built in functions so I have gone with that instead. Sep 11, 2012 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.