WordPress Function to Create a Breadcrumb Navigation Menu

The first time I started using breadcrumbs was as a part of the Yoast SEO plugin. While that’s a very well-written and successful plugin, I do think it oversteps its bounds in many ways, and I prefer not to install it for several reasons. The main one is that it adds so much functionality to wp-admin that it ends up confusing admin users. It also gives them the ability to jam keywords that may be doing them more harm than good.

But I do appreciate the breadcrumbs, and they’re really tricky to create! To that end, I came up with my own template tag for breadcrumbs, and it responds to a variety of views, to include single, search, custom post types, and 404. It also “crumbs down” into child posts or child terms of the current view.

Here’s the gist.

As a word of warning, this function contains references to other functions from my theme that you probably won’t have running, so, as always, read it and understand it before you use it. That said, you can also check out the helper functions referenced in the main breadcrumbs function.