Title: Breadcrumbs Structured Data
Last modified: July 26, 2019

---

# Breadcrumbs Structured Data

 *  Resolved [sally](https://wordpress.org/support/users/sallyruchman/)
 * (@sallyruchman)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/)
 * Hello,
 * im using the actual Version of Yoast. I have activated Breadcrumbs for my Pages/
   Posts.
 * I have added the code to header.php
 * <?php if(!is_front_page()): ?>
    <?php if ( function_exists(‘yoast_breadcrumb’)){
   yoast_breadcrumb(‘<p id=”breadcrumbs”>’,'</p>’); } ?> <?php endif; ?>
 * The Breadcrumbs are shown that’s fine. But when checking with Google Structured
   Data Testing Tool my Pages or Posts, the Breadcrumb Schema is not recognized 
   there.
 * Do I need another PHP snippet to achieve this?
 * Thx
    Sally
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fbreadcrumbs-structured-data%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Thread Starter [sally](https://wordpress.org/support/users/sallyruchman/)
 * (@sallyruchman)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/#post-11772772)
 * Hello,
 * still not getting the JSON+LD markup to the breadcrumbs output when checking 
   with Structured Data Tool.
    Can someone give me a hint?
 * Thx
 *  Thread Starter [sally](https://wordpress.org/support/users/sallyruchman/)
 * (@sallyruchman)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/#post-11777254)
 * Hello,
 * found some script to add to the functions.php, but the Breadcrumbs List Output
   is still not shown in Google Structured Data Tool
 * function crumb_json($crumb){
    $items = array(); foreach($crumb as $k => $v){ 
   $items[] = array( ‘@type’ => ‘ListItem’, ‘position’ => $k+1, ‘item’ => array(‘
   @type’ => ‘WebPage’, ‘@id’ => $v[‘href’], ‘name’ => $v[‘text’]) ); }
 *  $crumb = array(
    ‘@context’ => ‘[http://schema.org/&#8217](http://schema.org/&#8217);,‘
   @type’ => ‘BreadcrumbList’, ‘itemListElement’ => $items ); printf(‘<script type
   =”application/ld+json”>%s</script>’, json_encode($crumb)); }
 * Anyone an Idea how to fix this?
 * Thx
    Sally
 *  Thread Starter [sally](https://wordpress.org/support/users/sallyruchman/)
 * (@sallyruchman)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/#post-11782868)
 * ???
 *  Plugin Support [amboutwe](https://wordpress.org/support/users/amboutwe/)
 * (@amboutwe)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/#post-11810717)
 * Breadcrumb schema is output on content pages, not the homepage. Looking at a 
   few of your content pages, we see breadcrumb schema twice. One set is part of
   the Yoast schema and the other is likely added with the code you provided above.
 *  Thread Starter [sally](https://wordpress.org/support/users/sallyruchman/)
 * (@sallyruchman)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/#post-11811336)
 * Hello Abboutwe,
 * Following Snippet I have in the Header.php:
 * <?php if(!is_front_page()): ?>
    <?php if ( function_exists(‘yoast_breadcrumb’)){
   yoast_breadcrumb(‘<p id=”breadcrumbs”>’,'</p>’);
 * $breadcrumbs = yoast_breadcrumb(”,”,false);
    } ?> <?php endif; ?>
 * But with the Snippet in Header.php alone checking under google structured data
   testing the JSON LD Output (BreadcrumbList) is NOT shown.
 * To get the correct markup I have to add the following snippet to the functions.
   php:
 * add_filter(‘wpseo_breadcrumb_links’, ‘entex_add_crumb_schema’, 10, 1);
    function
   entex_add_crumb_schema($crumbs) {
 *  if( ! is_array( $crumbs ) || $crumbs === array()){
    return $crumbs; }
 *  $last = count($crumbs);
    $listItems = []; $j = 1;
 *  foreach ( $crumbs as $i => $crumb ) {
 *  $item = [];
    $nr = ($i + 1);
 *  if(isset($crumb[‘id’])){
    $item = [ ‘@id’ => get_permalink($crumb[‘id’]), ‘name’
   => strip_tags( get_the_title( $id ) ) ]; }
 *  if(isset($crumb[‘term’])){
    $term = $crumb[‘term’];
 *  $item = [
    ‘@id’ => get_term_link( $term ), ‘name’ => $term->name ]; }
 *  if(isset($crumb[‘ptarchive’])){
    $postType = get_post_type_object($crumb[‘ptarchive’]);
 *  $item = [
    ‘@id’ => get_post_type_archive_link($crumb[‘ptarchive’]), ‘name’ 
   => $postType->label ]; }
 *  /* READ NOTE BELOW: */
 *  if($nr == $last){
    if(is_author() && !isset($crumb[‘url’])) $crumb[‘url’] = 
   esc_url(get_author_posts_url(get_queried_object_id())); }
 *  /* The ‘text’ indicates the current (last) or start-path crumb (home)*/
    if(
   isset($crumb[‘url’])) { if($crumb[‘text’] !== ”) { $title = $crumb[‘text’]; }
   else { $title = get_bloginfo(‘name’); }
 *  $item = [
    ‘@id’ => $crumb[‘url’], ‘name’ => $title ]; }
 *  $listItem = [
    ‘@type’ => ‘ListItem’, ‘position’ => $j, ‘item’ => $item ];
 *  $listItems[] = $listItem;
    $j++; }
 *  $schema = [
    ‘@context’ => ‘[http://schema.org&#8217](http://schema.org&#8217);,‘
   @type’ => ‘BreadcrumbList’, ‘itemListElement’ => $listItems ];
 *  $html = ‘<script type=”application/ld+json”>’ . stripslashes(json_encode($schema,
   JSON_PRETTY_PRINT)) . ‘</script> ‘;
    echo $html; remove_filter(‘wpseo_breadcrumb_links’,‘
   entex_add_crumb_schema’, 10, 1); return $crumbs; }
 * Why is the JSON LD markup not shown just with the snippet in header.php, why 
   do I have to add a extra code to functions to get the output shown correct, should
   this not be done from the Yoast Plugin iteslf?
 * Checked with Google Structured Data Tool my Content Pages, and see the BreadcrumbList
   Output just once present, where do you see it twice?
 * Thx
    Best regards Sally
 *  Plugin Support [amboutwe](https://wordpress.org/support/users/amboutwe/)
 * (@amboutwe)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/#post-11818446)
 * Using Google’s [Structured Data Testing Tool](https://search.google.com/structured-data/testing-tool#)
   on a post, you will see the first `BreadcrumbList` and a second `BreadcrumbList`
   under the `Webpage` schema.
 * This can also be seen in the source code as shown in this image: [https://pasteboard.co/IrV0Wcr.png](https://pasteboard.co/IrV0Wcr.png)
 *  Thread Starter [sally](https://wordpress.org/support/users/sallyruchman/)
 * (@sallyruchman)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/#post-11819807)
 * Hello Amboutwe,
 * ok, can you please tell me now, how is the correct implementation, that the BreadcrumbList
   Schema is output in the correct way for Yoast ? Do I need the code above in the
   functions.php ? Is the Yoast Output under Webpage normally, or should this not
   be a own Schema Detected like Breadcrumblist?
 * Thx
    Sally
 *  Plugin Support [amboutwe](https://wordpress.org/support/users/amboutwe/)
 * (@amboutwe)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/#post-11820542)
 * To output the breadcrumb schema by Yoast, you do not need to add any code. Simply
   enable the breadcrumb feature and the plugin will automatically add `BreadcrumbList`
   to the combined schema.
 * If you want breadcrumbs to be visible on the page, you would need to add code
   to your theme or use the Yoast breadcrumb shortcode.
 * [https://kb.yoast.com/kb/implement-wordpress-seo-breadcrumbs/](https://kb.yoast.com/kb/implement-wordpress-seo-breadcrumbs/)
 *  Thread Starter [sally](https://wordpress.org/support/users/sallyruchman/)
 * (@sallyruchman)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/#post-11820672)
 * thx, ok, I took out the additional code in the functions now, and checked under
   combined schema where the breadcrumblist is present
 * Best regards
    Sally

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Breadcrumbs Structured Data’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-seo/assets/icon-256x256.gif?rev=3419908)
 * [Yoast SEO - Advanced SEO with real-time guidance and built-in AI](https://wordpress.org/plugins/wordpress-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo/reviews/)

## Tags

 * [jsonld](https://wordpress.org/support/topic-tag/jsonld/)
 * [Yoast](https://wordpress.org/support/topic-tag/yoast/)

 * 9 replies
 * 2 participants
 * Last reply from: [sally](https://wordpress.org/support/users/sallyruchman/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/breadcrumbs-structured-data/#post-11820672)
 * Status: resolved