Hi, I'm a web developer and blogger from Russia. My nickname is Dimox.
Sorry for my English, it's not my native. Read more about me and my blog.

WordPress Breadcrumbs Without a Plugin

WordPress Breadcrumbs Without a Plugin

Breadcrumbs is an important element of a web site navigation, which boosts his usability. Especially it concerns to a sites with a complex structure. Unfortunatelly, I don’t use breadcrumbs on my sites, may be because their structure is very simple or because I could not find a way of making breadcrumbs, suitable for me.

I have seen a different ways of a breadcrumbs implementation on WordPress sites, but not one of them I does not like, because all of them does not display a full chain of links. So I have created my version of WordPress breadcrumbs without a plugin.

Yes, there is a ready plugins for WordPress breadcrumbs, but I prefer to use a short code snippets, which doing the same.

Features of my version of WordPress breadcrumbs

  • Displays a full chain of links to the current page. For example, if the current post is in a second level category, so breadcrumbs will looks like this:

    Home » Category » Subcategory » Post Title

    But all, what I have seen, displays only such an option (excluding plugins):

    Home » Subcategory » Post Title

    The same applies to pages and subpages. For example, for a 3rd level page breadcrumbs will looks like this:

    Home » Page Level 1 » Page Level 2 » Page Level 3

  • Breadcrumbs is appearing on a following types of WordPress pages:

    • paged navigation (like sitename.com/page/2/);
    • category archive;
    • tag archive;
    • daily archive;
    • monthly archive;
    • yearly archive;
    • author archive;
    • custom post type;
    • single post page;
    • single page;
    • attachment page;
    • search results;
    • 404 error page.
  • adding a page number (if archive page is second or more);

  • custom symbol of delimiter;

  • custom text for a ‘Home’ link;

  • current crumb styling;

  • integrated microdata.

WordPress breadcrumbs function (last updated: 2015.09.14)

Simply paste this function into the functions.php file of your theme (excluding <?php) and then paste the following code in a place of your theme, where breadcrumbs must appearing:

<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>

All that remains to do for now, is to design your breadcrumbs with CSS. You can use .breadcrumbs for styling breadcrumbs block and .breadcrumbs .current for styling a current crumb.

You can also look at breadcrumbs video tutorial, which show you how to install this function on TwentyTen WordPress theme.

Function works on WordPress 3.0 or higher.

Cоmmеnts (638):
  1. 600
    carlos said:


    Thank you so much for this code.

    I`v read all the comments and try to figure out how to have this:


    Like this:

    Home>>products>>sony>>mp3 player>>MX DVZ

    Is it possible


  2. 601
    Thomas said:

    Hi Dimox,

    great work. Before I had a few problems with the Breadcrumb NavXT plugin but your code solved my problem. Less plugins – less trouble, thank you for that ;-)

    However, my website is a Multi-site network and I do have one little problem. On the jobs-board landing page page, if you click on a job it looks like that:
    You are here: Home » Job Listing » Early Childhood Teacher – Lismore
    If you want to go back to the parent page (job listings) it goes to an error 404 page or and if you do the same on another site of the website network it goes to http://jobshubnct.org.au/taree/job-applications/

    Could you please have a look?

    Thanks for your help

  3. 602


    Thanks for this great code. I have only one problem and it is when I hover the category link the title is ” View all posts in xxx ” – which xxx is the category name -. My question is how to make the link hover is only the category name? I will appreciate your answer very much.

    Thanks in advance,

    • 603


      Find this row (in 3 places):

      if ($show_title == 0) $cats = preg_replace('/ title="(.*?)"/', '', $cats);

      and paste the following after it:

      $cats = str_replace('View all posts in ', '', $cats);
  4. 605


    my problem is that the trail is working for all sites etc. But I have custom post types and they are all in german. So for example I have this right in german: home > zimmer > standard zimmer its correct! But in english it is: home > zimmer > standard room but i must be home > ROOMS > standard room When its like this iI always come back to german Zimmer not english “rooms”.

  5. 607
    Wayan Adika said:

    Thanks for the tutorial, I try to implemented your tutorial in my next project using Twenty Twelve themes but got error,
    I put the at single.php and got error, and I try to put in header.php also got error. Any advise will be appreciate

    Wayan Adika

  6. 608

    Thank you so much, Dimox. This is exactly what I was looking for.

    P.S.: Code is poetry!

  7. 609

    Hi, I have been using this code for a couple years and it has worked great but I have recently come to an issue with hierarchical custom post types.

    What I would like is for it to display: home > custom_post_type_name > post_parent > post
    but what is happening is it is not displaying the post parent, instead it shows as: home > custom_post_type_name > post

    I noticed one user posted this solution but they didn’t specify where in the code it is to go or if it’s replacing a snippet of code, it doesn’t appear to work where I think it is to go.

    Any help would be greatly appreciated.

  8. 610


    I want to display all submenu in breadcrums, for that what can i changed in code ?
    for example my menu: About ->team -> culture -> history

    so when i click on team breadcrums display like: You are here: About ->team -> culture -> history

  9. 613


    Nice snippet, tank you!

    I have a question, thou: Why I cannot use bloginfo(‘name’) instead of Home in
    $text[‘home’] = ‘Home’; // text for the ‘Home’ link

    It pushed the text outside the snippet.

    Thank you

  10. 615

    Thank you for the great snippet! I have one question: Is it possible to limit the breadcrumb length?


  11. 619
    Jessica said:

    Hi Dimox
    Thank you kindly for this option.
    What would be the way to make current page clickable?
    The last entry in breadcrumbs.

  12. 621
    ThemeFlavour said:

    In search result, i got this mydomain.com > Home > News

    How to delete Home > ?

    I just want to like this mydomain.com > News

  13. 622
    Jon Eyrick said:

    I freaking love you for this, great job! Good code. Thanks

  14. 623
    Millena said:

    Hi thank you very much for the codes! Really helped me. But i just need the parent page to appers.

    Page2 is parent of page1. Is it possible to apears also do page2 NOT only Home>page1>post

    Thank you

  15. 624
    Doeri said:

    Hi Dimox

    Breadcrumps are a big problem for wordpress. I will try to implement your code in one of my websites. I am not a programmer, that is why I want to ask you a question about pasting this function into function.php file. Where exactly I have to paste this code, for example at the top of the file or after all the file’s functions.

    Thank you in advance!

  16. 625
    Doeri said:

    I just saw your video tutorial how to implement the code. Thank you again!

    • 628
      Doeri said:

      I have one more question, on the blog posts in my theme the breadcrumbs work perfect, I would like to ask you where to paste the code for pages so I could have this navigation on my entire website.

      Thank you in advance,

  17. 627
    Piyush said:

    Hi, nice snippet.Very useful for me, but i would like to know how to disable it on certain pages in my website..
    i tried like this
    .page-id-XX .breadcrumbs { display: none; }

    But its not effective..

  18. 631
    Alessio Soggetti said:

    Wonderful piece of code: saved me a lot of time.
    Thank you very much!

  19. 632
    Alessio Soggetti said:


    I’m experiencing a little problem.

    I set these categories in WP:

    – Prodotti

    — Alimentazione
    — — Gas
    — — Pellet
    — — Legna

    — Convezione
    — — Convezione Acqua Calda
    — — Convezione Aria Calda
    — — Convezione Naturale

    — Tipologia
    — — Accessori
    — — Camini
    — — Stufe

    But i’ve got different results:
    1. http://www.edilfire.it/prodotti/tipologia/camini/camino-pellet-convezione-naturale-02/
    2. http://www.edilfire.it/prodotti/tipologia/stufe/stufa-gas-convezione-acqua-calda-02/

    The first one is correct, the second is not: I think the problem is related to the alphabetical order since in this page the breadcrumbs structure changes and shows “Convezione” instead of “Stufe”.

    Can you tell me how to fix it?

  20. 636
    Christian Witt said:


    obviously the path does not translate with wpml. do you have a wpml-ready version?
    or: what is the variable to change to _(‘my_page_name’, ‘you_theme_name’); ?

    thanks a lot!

  21. 638

    This might be a bug
    My WordPress does not need to set the classification

    Catchable fatal error: Object of class WP_Error could not be converted to string in /…/themes/xxx/functions.php on line 1512

     $cat = get_the_category(); $cat = $cat[0];  
     $cats = get_category_parents($cat, TRUE, $delimiter);  
     if ($show_current == 0 || get_query_var('cpage')) $cats = preg_replace("#^(.+)$delimiter$#", "$1", $cats);  
     line 1521<strong>$cats = preg_replace('#<a>]+)>([^<]+)#', $link_before . '<a>' . $link_in_before . '$2' . $link_in_after .'</a>' . $link_after, $cats); </strong> 
     if ($show_title == 0) $cats = preg_replace('/ title="(.*?)"/', '', $cats);  
     echo $cats;
Соmmеnt раgеs: « 1 10 11 12
Lеаvе а Соmmеnt

© 2009–2015 Dimox.net  •  Privacy Policy