WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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

share|improve this answer
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. – fightstarr20 Sep 11 '12 at 14:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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