I am using Yoasts Wordpress SEO and I have set up my breadcrumbs. The problem is that my page setup is s follows.

/blog - On this page I query the posts and display them. The posts themselves have nothing before them in the URL.

The breadcrumb shows as follows.

Home / Category / Page Title

I want it to show like this.

Home/ Blog / Category / Page Title

Is this possible?


Here's the general principle of what you need to do:

  1. Hook into the wpseo_breadcrumb_links or wp_seo_get_bc_ancestors API filters.
  2. Add your Blog into the WordPress SEO Breadcrumb $links array, using array_splice.

Place this in your theme's functions.php:

 * Conditionally Override Yoast SEO Breadcrumb Trail
 * http://plugins.svn.wordpress.org/wordpress-seo/trunk/frontend/class-breadcrumbs.php
 * -----------------------------------------------------------------------------------

add_filter( 'wpseo_breadcrumb_links', 'wpse_100012_override_yoast_breadcrumb_trail' );

function wpse_100012_override_yoast_breadcrumb_trail( $links ) {
    global $post;

    if ( is_home() || is_singular( 'post' ) || is_archive() ) {
        $breadcrumb[] = array(
            'url' => get_permalink( get_option( 'page_for_posts' ) ),
            'text' => 'Blog',

        array_splice( $links, 1, -2, $breadcrumb );

    return $links;

Note: You may need to update the code specific to your site or needs, but the general idea stays the same.

  • This worked perfectly, after changing my conditionals, url and text values to suit my needs. Thanks. – crdunst Oct 1 '14 at 10:24
  • Weird. This code replaced 'Category' with 'Blog' instead of adding it before. – Michael Rogers Nov 4 '17 at 13:29
  • FIXED: in my case it needed "2, -3" instead of "1, -2" not sure why but it works that way. – Michael Rogers Nov 4 '17 at 13:31

protected by Community Feb 15 '18 at 11:22

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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