• Google Search Console complains that breadcrumbs in the Stargazer do not contain an “item” property. To fix this, I suggest changing this…

    stargazer/library/ext/breadcrumb-trail.php line 193

    // Check if the item is linked.
    preg_match( '/(<a.*?>)(.*?)(<\/a>)/i', $item, $matches );
    
    // Wrap the item text with appropriate itemprop.
    $item = !empty( $matches ) ? sprintf( '%s<span itemprop="name">%s</span>%s', $matches[ 1 ], $matches[ 2 ], $matches[ 3 ] ) : sprintf( '<span itemprop="name">%s</span>', $item );

    To this…

    // Check if the item is linked.
    preg_match( '/<a (.*?)>(.*?)<\/a>/i', $item, $matches );
    
    // Wrap the item text with appropriate itemprop.
    $item = !empty( $matches ) ? sprintf( '<a %s itemprop="item"><span itemprop="name">%s</span></a>', $matches[ 1 ], $matches[ 2 ] ) : sprintf( '<span itemprop="name">%s</span>', $item );
    • This topic was modified 5 years, 2 months ago by wp_kc.
  • The topic ‘Fix for breadcrumb schema.org omission’ is closed to new replies.